Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2006, 05:22 PM
New Pligger
 
Join Date: Mar 2006
Posts: 23
Thanks: 0
Thanked 2 Times in 1 Post
tag cloud

how can i put the tag cloud on the index.php page?
Reply With Quote
  #2 (permalink)  
Old 03-12-2006, 06:11 PM
New Pligger
 
Join Date: Mar 2006
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Hi

This is extremely sloppy because I just did it.

What I did was I first made a new file called index_cloud.php in the root folder and put the following code in it:

Quote:
<?php
$range_names = array($main_smarty->get_config_vars('PLIGG_Visual_Tags_All'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_48_Hours'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_This_Week'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_This_Month') , $main_smarty->get_config_vars('PLIGG_Visual_Tags_This_Year')) ;
$range_values = array(0, 172800, 604800, 2592000, 31536000);

if(($from = check_integer('range')) >= 0 && $from < count($range_values) && $range_values[$from] > 0 ) {
$from_time = time() - $range_values[$from];
$from_where = "FROM tags, links WHERE tag_lang='$dblang' and tag_date > FROM_UNIXTIME($from_time) and link_id = tag_link_id and link_status != 'discard'";
$time_query = "&amp;from=$from_time";
} else {
$from_where = "FROM tags, links WHERE tag_lang='$dblang' and link_id = tag_link_id and link_status != 'discard'";
}
$from_where .= " GROUP BY tag_words";

$max = max($db->get_var("select count(*) as words $from_where order by words desc limit 1"), 2);
$coef = ($tags_max_pts - $tags_min_pts)/($max-1);

$main_smarty->assign('tags_largest_tag', $max);
$main_smarty->assign('tags_coef', $coef);

$res = $db->get_results("select tag_words, count(*) as count $from_where order by count desc limit $tags_words_limit");
if ($res) {
foreach ($res as $item) {
$words[$item->tag_words] = $item->count;
}
ksort($words);
$main_smarty->assign('words', $words);

}

$main_smarty->assign('tags_min_pts', $tags_min_pts);
$main_smarty->assign('tags_max_pts', $tags_max_pts);
$main_smarty->assign('tags_words_limit', $tags_words_limit);

if(!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) $current_range = 0;
if(isset($time_query)){$main_smarty->assign('time_query', $time_query);}
$main_smarty->assign('current_range', $current_range);
$main_smarty->assign('range_names', $range_names);
$main_smarty->assign('range_values', $range_values);
$main_smarty->assign('count_range_values', count($range_values));
?>
You could cut out the unneeded parts. I basically copied some portions of the cloud.php file


Then I went to index.php and put

Quote:
include('index_cloud.php');
right after the other include lines



Then I went to templates\all_sidebar.tpl

and put

Quote:
<div id="tagcloud">

<div style="margin: 20px 0 20px 0; line-height: {$tags_max_pts}pt; margin-left: 100px;">
{foreach from=$words item=count key=word}
{$size = $tags_min_pts + ($count-1)*$tags_coef}
<span style="font-size: {math equation="x + (y - 1) * z" x=$tags_min_pts y=$count z=$tags_coef}pt"><a href=" index.php?search={$word}{$time_query}&amp;tag=true ">{$word}</a></span>&nbsp;&nbsp;
{/foreach}

</div>
</div>
Next in your CSS file you could create a

Quote:
#tagcloud {

}
block and style it as you want.


This is solution is probably overkill but it works. I will try to make it better and post the solution
Reply With Quote
The Following User Says Thank You to garg For This Useful Post:
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Tag Cloud links ppelsmaeker Installation and Upgrade Help 0 08-18-2008 05:13 PM
Random Link Cloud Box chuckroast Module Sales 0 07-11-2008 11:10 AM
Tags not cloud in Pligg v9.9 bhatiacane Bug Report 4 05-03-2008 02:16 AM
How does the Tag cloud works? Niko General Help 1 03-31-2008 02:47 AM
Tag Cloud remembers also deleted tags jackdaw Bug Report 0 08-29-2006 04:14 AM


Search Engine Friendly URLs by vBSEO 3.2.0