Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-28-2008, 12:34 PM
Constant Pligger
 
Join Date: Feb 2007
Posts: 183
Thanks: 13
Thanked 24 Times in 19 Posts
Weekly tags to the sidebar

A while ago I modified my sidebar's tag cloud to show only tags from last seven days. This way the users see tags that are currently popular, and more up-date than the most popular tags.

If someone wants to do the same here's how I did it. I used code snippets from the tags.php file but if someone has more simplified way to do this please let me know.

Step 1
Open your templates sidebar_modules/tags.tpl-file in text editor and modify this part

Code:
{php}
	include_once(mnminclude.'tags.php');
	global $main_smarty;
	
	$cloud=new TagCloud();
	$cloud->smarty_variable = $main_smarty; // pass smarty to the function so we can set some variables
	$cloud->word_limit = tags_words_limit_s;
	$cloud->min_points = tags_min_pts_s; // the size of the smallest tag
	$cloud->max_points = tags_max_pts_s; // the size of the largest tag
	
	$cloud->show();
	$main_smarty = $cloud->smarty_variable; // get the updated smarty back from the function
{/php}
to look like this

Code:
{php}
	include_once(mnminclude.'tags.php');
	global $main_smarty;
	$range_values = array(604800);

	$cloud=new TagCloud();
	$cloud->smarty_variable = $main_smarty; // pass smarty to the function so we can set some variables
	$cloud->word_limit = tags_words_limit_s;
	$cloud->range_values = $range_values;
	$cloud->min_points = tags_min_pts_s; // the size of the smallest tag
	$cloud->max_points = tags_max_pts_s; // the size of the largest tag
	
	$cloud->show();
	$main_smarty = $cloud->smarty_variable; // get the updated smarty back from the function
{/php}
and keep all after this as it was before. Ofcourse you can change the heading of this sidebar module to Weekly tags or something but I think that you all know how to do it.
Then save the file to yourtemplate/sidebar_modules-folder as weeklytags.tpl.

Step 2
Open your templates sidebar.tpl-file and find this line

Code:
{if $Enable_Tags  eq 'true'} {assign var=sidebar_module value="tags"}{include file=$the_template_sidebar_modules."/wrapper.tpl"} {/if}
And change it to this

Code:
{if $Enable_Tags  eq 'true'} {assign var=sidebar_module value="weeklytags"}{include file=$the_template_sidebar_modules."/wrapper.tpl"} {/if}
Then upload your sidebar.tpl and weeklytags.tpl to the server and enjoy.
Reply With Quote
The Following 3 Users Say Thank You to Andtony For This Useful Post:
  #2 (permalink)  
Old 09-15-2008, 06:25 PM
Jessemn's Avatar
Casual Pligger
 
Join Date: Jun 2008
Location: Canada
Posts: 58
Thanks: 3
Thanked 11 Times in 10 Posts
This is actually a great mod. I would love to see my top tags change from week to week (to whatever is popular at the time), rather than remain stagnant. I'll add this tonight and see how it goes.

Thanks!
Reply With Quote
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
pligg tags table performance eben General Help 0 08-31-2008 06:37 PM
Tags not cloud in Pligg v9.9 bhatiacane Bug Report 4 05-03-2008 02:16 AM
Top 5 Tags sidebar based on last 24 h registration tbones Suggestions 0 03-13-2008 11:24 AM
How to add del.icio.us tags to your Pligg in a native manner abenamer Bug Report 10 06-01-2007 10:21 PM


Search Engine Friendly URLs by vBSEO 3.2.0