Mouse Posted December 19, 2006 Share Posted December 19, 2006 Ok so i have been playing with my site for a while and getting there very slowly... but heres the rub i am DYSLEXIC and am having issues following a tutorial and the code therein... the tutorial / code is over at http://www.scriptplayground.com/tutorials/php/Tag-Cloud/ and where i am at is[code]<html><head><style type="text/css">.tag_cloud { padding: 3px; text-decoration: none; }.tag_cloud:link { color: #81d601; }.tag_cloud:visited { color: #019c05; }.tag_cloud:hover { color: #ffffff; background: #69da03; }.tag_cloud:active { color: #ffffff; background: #ACFC65; }</style></head><body><?phpfunction get_tag_data() { $host = "localhost";$dbname = "###";$dbuser = "###";$dbpass = "###";$connection = mysql_connect($host, $dbuser, $dbpass) or die(mysql_error());$db = mysql_select_db($dbname) or die(mysql_error()); $result = mysql_query("SELECT uid ,firstname ,lastname FROM user ORDER BY uid DESC limit 20"); while($row = mysql_fetch_array($result)) { $arr[$row['firstname, lastname']] = $row['count']; } ksort($arr); return $arr; }function get_tag_cloud() { $min_font_size = 100%;$max_font_size = 250$;$tags = get_tag_data();$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(); // create an array to hold tag codeforeach ($tags as $tag => $count) { $size = $min_font_size + ($count - $minimum_count) * ($max_font_size - $min_font_size) / $spread; $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' . '" class="tag_cloud" href="http://www.mouse.nodstrum.com/full_profile?u$uid . '" title="\'' . $firstname $lastname . '\' profile">' . htmlspecialchars(stripslashes($tag)) . '</a>';}$cloud_html = join("\n", $cloud_tags) . "\n";return $cloud_html;?>//Here is some example HTML to call this tag builder.<h3>Sample Tag Cloud results</h3><div id="wrapper"<!-- BEGIN Tag Cloud --><?php print get_tag_cloud(); ?><!-- END Tag Cloud --></div></body></html>[/code]okay, so it is only likely to be a missing ; or me mixing $uid and $did <b>BUT</b> if anyone can help i would be most appreciativemany thanks Mouse Quote Link to comment Share on other sites More sharing options...
Mouse Posted December 19, 2006 Author Share Posted December 19, 2006 sorry should have said... error message saysParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/nodstrum/public_html/mouse/xxxtag.php on line 51thats the one that starts . '" class="tag_cloud" href="http:// Quote Link to comment Share on other sites More sharing options...
Hypnos Posted December 21, 2006 Share Posted December 21, 2006 You forgot a period between $firstname and $lastname.[code=php:0]$cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' . '" class="tag_cloud" href="http://www.mouse.nodstrum.com/full_profile?u$uid . '" title="'' . $firstname . $lastname . '\' profile">' . htmlspecialchars(stripslashes($tag)) . '</a>';[/code]EDIT: And you have your quotes mixed up around uid. I'm guessing it's suppose to be like this..[code=php:0]$cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' . '" class="tag_cloud" href="http://www.mouse.nodstrum.com/full_profile?u=' . $uid . '" title="'' . $firstname . $lastname . '\' profile">' . htmlspecialchars(stripslashes($tag)) . '</a>';[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.