Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Display Specific Categories on Homepage & the links in them

Quote Reply
Display Specific Categories on Homepage & the links in them
I am wondering if this can be done,
I want to display all categories, sub-categories, and links inside them on the home page and fill it completely in one column.
or it can maybe yahoo sub plug in but expanded all to max.... to show all cats, subcats, and links on home...

means:
Code:

Main1
sub1> link1 link2 link3 link4
sub2> link1 link1
sub3>sub-sub1>sub-sub2> link1 link2
sub3>sub-sub1>sub-sub2>sub-sub3>link1>link2>link3
sub4> link1 link1
Main2
sub1> link1 link2 link3 link4
sub2> link1 link1
sub3>sub-sub1>sub-sub2> link1 link2
sub3>sub-sub1>sub-sub2>sub-sub3>link1>link2>link3
sub4> link1 link1
Quote Reply
Re: [Mark2] Display Specific Categories on Homepage & the links in them In reply to
Try this thread as a start:
http://www.gossamer-threads.com/...i?post=243449#243449

You'll need to add another section to the global to get the links.
Quote Reply
Re: [afinlr] Display Specific Categories on Homepage & the links in them In reply to
Thank you .. that worked very nicely... this global allowed user to display all cats and subcats on home; however,
I just need now to display the links inside all of them on the home as well...
thanks...
mark
Quote Reply
Re: [Mark2] Display Specific Categories on Homepage & the links in them In reply to
If you are using version 3, I think you should be able to use the global below. Then in the template you can use something like

<%loop Map%><%Full_Name%><%loop Links%><%Title%><%endloop%><%endloop%>

sub {
my ($cat,@cats);
my $tags = shift;
my $cat_db = $DB->table('Category');
my $link_db = $DB->table('Links','CatLinks');
$cat_db->select_options ('ORDER BY Full_Name ASC');
my $sth = $cat_db->select (['Full_Name','ID','Name'] );
while ($cat = $sth->fetchrow_hashref) {
$cat->{'url'} = $cat_db->as_url($cat->{'Full_Name'});
$cat->{'depth'} = ($cat->{'Full_Name'} =~ tr/\///);
$link_db->select_options('ORDER BY Title ASC');
$cat->{'Links'}=$link_db->select(['Title','ID'],{CategoryID=>$cat->{ID}})->fetchrow_hashref;
push @cats, $cat;
}
return {Map=>\@cats};
}