Gossamer Forum
Home : Products : Gossamer Links : Discussions :

<%categoryID%> to call all categories

Quote Reply
<%categoryID%> to call all categories
Is there are tag similar to <%categoryID%> to call all the categories at the same time?

CCUnet
my Christian web
Quote Reply
Re: [ccunet] <%categoryID%> to call all categories In reply to
Could you explain yourself a little bit more? You were a bit brief Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] <%categoryID%> to call all categories In reply to
Andy,

I'm trying to build a page using pagebuilder that has all the links that have a column isPriority set to yes.

Since pagebuilder simple pages do not seem to support the <%link%> and <%category%. tags i have to use a pagebuilder category page.

However that restricts me to only one category using <$categoryID%> ex page.cgi?page=partners;category=<%categoryID%>

So I am trying to find away to call all the categories like so page.cgi?page=partners;category=all.

Hope that makes sense. There may be a better way to do it but that is what I've come up with.

Thanks for the help

CCUnet
my Christian web
Quote Reply
Re: [ccunet] <%categoryID%> to call all categories In reply to
Could you not do it with a simple global, or plugin? Something like;


Code:
sub {

my $table = $DB->table('Links');
my $sth = $table->select( { isPriority => 'Yes' } ) or return "Error: $GT::SQL::error";

my ($link,$hit,$output);

while (my $hit = $sth->fetchrow_hashref) {
$link = $db->select ('*', { ID => $hit->{ID} })->fetchrow_hashref;

$output .= Links::SiteHTML::display ('link', $link);

}

return $output;

}

That should return all the links in your database with 'isPriority' set to 'Yes'

Hope that helps Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] <%categoryID%> to call all categories In reply to
Andy,

I tried the sub as a global named link_partners and called like this

Code:
<%link_partners%>
<%loop link_partners%>
<a href="http://www.mysite.com/cgi-bin/jump.cgi?<%ID>"><%Title%></a><BR>
<%Description%><
<small>link partner</small><%include link_partners%>
<%loop link_partners%>
<a href="http://www.mychristianweb.com/cgi-bin/guide/jump.cgi?<%ID>"><%Title%></a><BR>
<%Description%><BR>
<%endloop%>


but the page just chokes and never displays.

thanks

CCUnet
my Christian web
Quote Reply
Re: [ccunet] <%categoryID%> to call all categories In reply to
Why the loop?

Try;

<%if link_partners%>
<%link_partners%>
<%endif%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] <%categoryID%> to call all categories In reply to
Andy,

I was just following a previous example I had. trying to learn how to do this for myself.

anyway I got this error

Unable to compile 'link_partners':

CCUnet
my Christian web
Quote Reply
Re: [ccunet] <%categoryID%> to call all categories In reply to
Sorry, a boo boo on my end Tongue Try changing;

$link = $db->select ('*', { ID => $hit->{ID} })->fetchrow_hashref;

to

$link = $table->select ('*', { ID => $hit->{ID} })->fetchrow_hashref;

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] <%categoryID%> to call all categories In reply to
That did the trick Andy. Thanks

I'll need to dissect this code to learn how it works

CCUnet
my Christian web
Quote Reply
Re: [ccunet] <%categoryID%> to call all categories In reply to
Its pretty simple. All it does, is go through the database and find links where 'isPriority' => 'yes', and then go through a loop. It then grabs each links details, and passes it to LSQL's template parsing system. You can change the template it uses if you want too :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!