libs/html1.php
created code to create a list of the top five tags
function tag_list(){
global $db;
$tag_list = $db->get_results("SELECT `tag_words`, COUNT(tag_words) AS NumOccurrences FROM `pligg_tags` GROUP BY `tag_words` ORDER BY 'NumOccurrences' LIMIT 0, 6");
$tag_list = object_2_array($tag_list);
foreach($tag_list as $id => $rs){
$tag_list[$id]['tag_words'] = $rs['tag_words'];
}
return $tag_list; // returns list to function summon
}
then added
$taglist = tag_list();
$var_smarty->assign('taglist', $taglist);
to "function do_sidebar()" so this array would be passed on into the tpl files.
templates/oioioi/sidebar_modules/catagories.tpl
This means that using a submit loop;
{section name=thetag loop=$taglist}
{$taglist[thetag].tag_words}
{/section}
inserts all tag names onto the page
With this as a starting point, we can then create a second loop, using tags, which is inserted directly after the previous loop closes (i.e. right after {/section})
{section name=thetag loop=$taglist start=$start}
[li{if $cat_array[thecat].principlecat neq 0} class="dir"{/if}]
[a href="{$my_pligg_base}/search.php?search={$taglist[thetag].tag_words}&tag=true"]{$taglist[thetag].tag_words}[/a]
{if $cat_array[thecat].principlecat eq 0}[/li]{else}[ul]{/if}
{/section}
This uses the my_pligg_base url, to avoid problems with incorrect linking, and attaches the search.php?search as with the tag cloud. This links to the page.
No comments:
Post a Comment