Monday, September 28, 2009

MC Converting Tags into new catagories

Several steps have been undertaken so far;

libs/html1.php


created code to create a list of all tags


function tag_list(){ // this creates a list of all tags in the database

global $db; // connects to database details

$tag_list = $db->get_results("SELECT tag_words FROM pligg_tags ORDER BY 'tag_words'"); // selects all tags in the database

$tag_list = object_2_array($tag_list); // converts results to an array

foreach($tag_list as $id => $rs){

$tag_list[$id]['tag_words'] = $rs['tag_words']; // links the tag name to each tag

}


return $tag_list; // returns list to function summon


}


templates/oioioi/sidebar_modules/catagories2.tpl


Added


{include file=$the_template_sidebar_modules."/categories2.tpl"}


to add a second layer with the tags through file categories 2


templates/oioioi/sidebar_modules/catagories2.tpl


then added


$taglist = tag_list();

$var_smarty->assign('taglist', $taglist);


so this array would be passed on into the tpl files.


This means that using a submit loop;


{section name=thetag loop=$taglist}

{$taglist[thetag].tag_words}

{/section}


inserts all tag names onto the page


As a result, there is a second catagory column, with a list of all tags. The next step is to insert these into buttons, and attach the search code used in the tag cloud page.

No comments:

Post a Comment