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

Articles/links by subcategory..

Quote Reply
Articles/links by subcategory..
Okay, here is what I've been working on for the last two hours...
I created a column (enum) called LinkType with the following values: 'link' and 'article'

I put:
<%if links%>
<hr size=1>
<%articlelist%>
<hr size=1>
<%linklist%>
<%endif%>

in my category template and created the following globals:

------------------------------------------------------------
sub {
# lists the articles.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC','Limit 10');
$sth = $search_db->select ( { LinkType => 'article'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}

--------------------------------------------------------------
sub {
# lists the links.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC','Limit 10');
$sth = $search_db->select ( { LinkType => 'link'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}


Problem is it lists all the articles/links on the entire site on the subcategory pages, and am trying to just pull the articles/links from the subcategory???

Any suggestions....

</not a clue>
Quote Reply
Re: [Dinky] Articles/links by subcategory.. In reply to
Hi Dinky

This may help.

I don't use a global, just the following in the category template, make sure you have the link_article.html and link_link.html templates in the local directory.

<%loop links_loop%>
<%if LinkType eq 'link'%>
<%include link_link.html%>
<%endif%>
<%endloop%>
<%loop links_loop%>
<%if LinkType eq 'article'%>
<%include link_article.html%>
<%endif%>
<%endloop%>

Regards

minesite