ถามการแก้ไขโค๊ดคะ

<?php

$db_host = "127.0.0.1";
$db_user = "root";
$db_pass = "";
$db_name = "test";

mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
mysql_select_db($db_name);

$result1 = mysql_query("SELECT * FROM tags");
$row_p = mysql_fetch_assoc($result1);
$totalRows_p = mysql_num_rows($result1);

function tag_info() {
  $result = mysql_query("SELECT * FROM tags");
  while($row = mysql_fetch_array($result)) {
    $arr[$row['tagName']] = $row['count'];
  }
  //ksort($arr);
  return $arr;
}

function tag_cloud() {

    $min_size = 10;
    $max_size = 28;

    $tags = tag_info();

    $minimum_count = min(array_values($tags));
    $maximum_count = max(array_values($tags));
    $spread = $maximum_count - $minimum_count;

    if($spread == 0) {
        $spread = 1;
    }
   
    $cloud_html = '';
    $cloud_tags = array();
   
    $step = ($max_size - $min_size)/($spread);
   
    foreach ($tags as $tag => $count) {
        $size = $min_size + ($count - $minimum_count) * $step;

//  $size = ($max_size + $min_size)/$spread;
        $cloud_tags[] = '<a style="font-size: '. $size . 'px'
            . '" class="tag_cloud" href="http://127.0.0.1/websites/' . $tag . '.php'
            . '" title="\'' . $tag  . '\' returned a count of ' . $count . '">
'
            . htmlspecialchars(stripslashes($tag)) . '</a>'. $count;
    }

    $cloud_html = join("
", $cloud_tags) . "
";
    return $cloud_html;
}
   
?>

<style type="text/css">
.tag_cloud
    {padding: 3px; text-decoration: none;
    font-family: verdana;     }
.tag_cloud:link  { color: #FF66CC; }
.tag_cloud:visited { color: #9900FF; }
.tag_cloud:hover { color: #FF66CC; text-decoration:underline;}
.tag_cloud:active { color: #6699FF; text-decoration:underline;}

div.wrapper{
    position:absolute;
    height:200px;
    width:400px;
   
   
}
</style>


<div id="wrapper" class="wrapper">
 <?php print tag_cloud(); ?>
 <? echo $row_p['url']; ?>
</div>

--------------------------------------------------------------------------------------------------
ตรงบรรทัด
        $cloud_tags[] = '<a style="font-size: '. $size . 'px'
            . '" class="tag_cloud" href="http://127.0.0.1/websites/' . $tag . '.php'
            . '" title="\'' . $tag  . '\' returned a count of ' . $count . '">
'
            . htmlspecialchars(stripslashes($tag)) . '</a>'. $count;
    }

เกี่ยวกับลิงค์ของตัวนี้่น่ะคะ ตามโค๊ด จะลิงค์ไปตามข้อความที่ใส่ไว้ (แก้ไข URL หลักไม่ได้)
ถ้าจะแ้ก้ให้เป็นลิงค์ไปตามเว็บอื่นๆ ไม่เกี่ยวกับข้อความ จะทำได้มั้ยคะ

ปล.ตัวนี้เป็นฐานข้อมูลที่ใช้นะคะ table ของเดิม จะไม่มีข้อมูล "web" แต่ในนี้ได้เพิ่มข้อมูล "web" ไปแล้วนะคะ

-- phpMyAdmin SQL Dump
-- version 3.1.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 27, 2010 at 01:30 PM
-- Server version: 5.1.33
-- PHP Version: 5.2.9

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Table structure for table `tags`
--

CREATE TABLE IF NOT EXISTS `tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tagName` varchar(30) NOT NULL,
  `count` int(11) NOT NULL,
  `web` varchar(120) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `tags`
--

INSERT INTO `tags` (`id`, `tagName`, `count`, `web`) VALUES
(1, 'Tags_cloud', 7, 'http://www.test1.com/'),
(2, 'Tags_cloud2', 0, 'http://www.test2.com/'),
(3, 'tags5', 15, 'http://127.0.0.1/websites/tags5.php'),
(4, 'tags6', 45, 'http://127.0.0.1/websites/tags6.php');

27 พ.ค. 2553 3 1,505

ได้ครับ ....

โดยปกติมันก็จะคืนค่าเป็นข้อความ URL ธรรมดา เราสามารถดัดแปลงให้มันคืนค่า URL อะไรก็ได้ครับ

$cloud_tags[] = '<a href="'.$result[web].'"></a>';
#1

ได้ครับ ....

โดยปกติมันก็จะคืนค่าเป็นข้อความ URL ธรรมดา เราสามารถดัดแปลงให้มันคืนค่า URL อะไรก็ได้ครับ

$cloud_tags[] = '<a href="'.$result[web].'"></a>';
#2

ขอบคุณนะคะ ^__^

แต่ลองแล้วก็ยังไม่ได้เลยคะ T^T
#3
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^