Gossamer Forum
Home : Products : Gossamer Links : Discussions :

All category links on detailed page?

Quote Reply
All category links on detailed page?
Hi,

I'm looking for a way to show a list of all links of the current category on the detailed page.

If the user see the detailed page of a link, I like to show all other links from the same category in a list for better navigation in this category.

And: I have a special field in my db ("QuintaName") which should be displayed which each link.

The best would be if the current link which is displayed on the detailed page is not in the list ...

Possible?

I could pay for a good global ...

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] All category links on detailed page? In reply to
Hi Kailew,

This can be tried. It use the 'link.html' to print out the list. So you can change to other one if you like

sub {
my $id = shift;

my $catid = $DB->table('CatLinks')->select({LinkID=>$id})->fetchrow_hashref->{CategoryID};

my $db = $DB->table('CatLinks','Links');
my $cond = GT::SQL::Condition->new(
'CatLinks.CategoryID','=',$catid,
'CatLinks.LinkID','<>',$id);
my $rs = $db->select($cond,['Links.*'])->fetchall_hashref or return;
my $output ="";
foreach(@$rs){
$output .= Links::user_page('link.html',$_);
}
return $output;
}

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] All category links on detailed page? In reply to
Hello Dat,

sorry, doesn't work for me ...

I get this error:
"Can't use an undefined value as a HASH reference at (eval 56) line 4"

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] All category links on detailed page? In reply to
Sorry not telling the usage. Please pass through the ID of that link. For example, <%list_all_links($ID)%> if you name that global 'list_all_links'.

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] All category links on detailed page? In reply to
Hi Dat,

it's almost done ... I'm now trying for some time to change the links in the list from "jump.cgi" to "detailed_url" but I guess this isn't so easy as I first thought. Could you take another look ...? For your efforts I like to send you some $ ... please tell me a paypal-Account or a thing like that.

Kai
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] All category links on detailed page? In reply to
Hi Kailew,

Below code now should have the 'detailed_url' variable. So if in your current link.html template has something like this
---- link.html----
<a class="category_links" target="_blank" href="<%if detailed_url%><%detailed_url%><%else%><%db_cgi_url%>/jump.cgi?ID=<%ID%><%endif%>"><%Title%></a>
---link.html ----
the link will be to detail page.
---global ---
sub {

my $id = shift;

my $catid = $DB->table('CatLinks')->select({LinkID=>$id})->fetchrow_hashref->{CategoryID};

my $db = $DB->table('CatLinks','Links');
my $cond = GT::SQL::Condition->new(
'CatLinks.CategoryID','=',$catid,
'CatLinks.LinkID','<>',$id);
my $rs = $db->select($cond,['Links.*'])->fetchall_hashref or return;
my $output ="";
foreach(@$rs){
$output .= Links::SiteHTML::display('link',$_);
}
return $output;
}

---global---

For the payment info, paypal has not yet support users from my country.Therefore, I use ikobo.com but recently, it limits the senders. So , please just let it there until I have got a new payment getway.

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] All category links on detailed page? In reply to
Hello Dat,
seems to work now ...

The problem was, that I need the original link.html to create my "big" list on thecatgory-pages. But without using link.html the links were always build with jump.cgi ...

So I use link.html for the navigation-list and use a renamed link.html in my category.html for the main listing.

Another question: I try to put the link-list as a navigation-menu also on the category-page, but there it doesn't work. I think I can make it there by myself using the normal link-listing and using another renamed link.html but I'm not sure about the span-page-feature. Is the link-listing with link.html split into different pages everytime or can I control it with the link- or category-template?

Kai

ps: I can do the payment later, correct? I like to pay, because that helped me a lot ... and I have further questions ... Wink
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Quote Reply
Re: [kailew] All category links on detailed page? In reply to
Hi Kai,

This can be expanded to meet your requirements. Please PM me or send to dat@cgito.net, then we can discuss more.

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] All category links on detailed page? In reply to
Hi,

I test your code with a condition, but I obtain an error.

I want to limit the number of link.

---------------------------
sub {
my $id = shift;
my $catid = $DB->table('CatLinks')->select({LinkID=>$id})->fetchrow_hashref->{CategoryID};
my $db = $DB->table('CatLinks','Links');
my $cond = GT::SQL::Condition->new(
'CatLinks.CategoryID','=',$catid,
'CatLinks.LinkID','<>',$id);

$cond->bool('AND');
$link_db->select_options("ORDER BY Link.ID DESC", "Limit 5" );
my $sth = $link_db->select( $cond );


my $rs = $db->select($cond,['Links.*])->fetchall_hashref or return;
my $output ="...";
foreach(@$rs){
$output .= Links::SiteHTML::display('link',$_);
}
return $output;
}
-------------------

You have an idea ?

Thank you for your assistance.

Oyo
Quote Reply
Re: [Oyo] All category links on detailed page? In reply to
That seems to be good.
You can confirm ?

-------------
sub {
my $id = shift;
my $catid = $DB->table('CatLinks')->select({LinkID=>$id})->fetchrow_hashref->{CategoryID};
my $db = $DB->table('CatLinks','Links');
$db->select_options ('ORDER BY hits DESC', 'LIMIT 1');
my $cond = GT::SQL::Condition->new(
'CatLinks.CategoryID','=',$catid,
'CatLinks.LinkID','<>',$id);
my $rs = $db->select($cond,['Links.*'])->fetchall_hashref or return;
my $output ="...";
foreach(@$rs){
$output .= Links::SiteHTML::display('link',$_);
}
return $output;
}

-----------------------

Thank you for your answer.

Last edited by:

Oyo: Aug 12, 2006, 1:58 PM