30 Jun
Php script for make TAG Cloud for more interactive website
TAG Cloud. That’s show our TAG or others for make our website more interactive. I use this for my classified website. I want to display TAG of Ads’ TAG. After search at google, I use this script and I think this script good.
This for Style. Place it between <head> and </head> of our website.
You can change/edit the style for your own purpose. You can set the color, border if you want or other else.
And this is example for using tag cloud. Example display TAG for categories
< ?php /** this is our array of tags * We feed this array of tags and links the tagCloud * class method createTagCloud */ $tags = array( array('weight' =>40, 'tagname' =>'Art and Entertainment', 'url'=>'http://obamatruthsquad.com/category/art-and-entertainment'), array('weight' =>12, 'tagname' =>'kloxo server', 'url'=>'http://obamatruthsquad.com/category/internet/kloxo-server'), array('weight' =>15, 'tagname' =>'BUSINESS', 'url'=>'http://obamatruthsquad.com/category/business'), array('weight' =>10, 'tagname' =>'domain', 'url'=>'http://obamatruthsquad.com/category/internet/domain'), ); /*** create a new tag cloud object ***/ $tagCloud = new tagCloud($tags); echo $tagCloud -> displayTagCloud(); ?>< ?php class tagCloud{ /*** the array of tags ***/ private $tagsArray; public function __construct($tags){ /*** set a few properties ***/ $this->tagsArray = $tags; } /** * * Display tag cloud * * @access public * * @return string * */ public function displayTagCloud(){ $ret = ''; shuffle($this->tagsArray); foreach($this->tagsArray as $tag) { $ret.=''.$tag['tagname'].''."\n"; } return $ret; } } /*** end of class ***/ ?>
Hope this usefull



Respond to this post