Gossamer Forum
Home : Products : Gossamer Links : Discussions :

category list for menu

Quote Reply
category list for menu
New to the game.

We need to add a menu that will contain the top level categories. This menu will appear on every page.

We have added <%categories%> but the format is the same as the index page.

We need to be able to create another tag that is associated with an html template page.

Any suggestion?
Quote Reply
Re: [OP] category list for menu In reply to
You can do this with a global - copy this into the blank box at the bottom of admin->build->template globals:

sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','Name'] );
my $output="";
while (my ($root_cat,$full_name) = $sth->fetchrow_array) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<a href="$CFG->{build_root_url}/$url/"><b>$full_name</b></a><br>~;
}
return $output;
}

call it category_menu and then where you want it in your template <%category_menu%>
Quote Reply
Re: [OP] category list for menu In reply to
Thanks Afinlr. Worked perfectly.
Quote Reply
Re: [afinlr] category list for menu In reply to
Hi,
I am looking for a way to list the same level categories on each category page, so at the bottom of the category I would list the other categories on the same level with a title like "Try these other categories", I am not looking to list "related categories", but all the categories that are on the same level as the present category.
Thanks,
George