Gossamer Forum
Home : Products : Links 2.0 : Customization :

Category display in search

Quote Reply
Category display in search
Hi there!

I would like to change the way that the category is displayed within the search results. Instead of:

Category Name

Site 1
Description

Site 2
Description


Category Name

Site 3
Description


I would like to display the results thus:

Site 1
Description
From category: Home > Computing > Internet

Site 2
Description
From category: Home > Computing > Internet

Site 3
Description
From category: Home > Computing > Software


Would there be any way of achieving this?
Thanks guys!
Quote Reply
Re: Category display in search In reply to
I tried helping another LINKS user with doing this and for some reason it did not work for him...

Let's see if you can figure it out....

Wink

1) Delete the following codes in your search.cgi file:

Code:
$link_results .= qq|$title_linked|;

2) Then create a seperate template file called search_links.html file. Go to the following URL to find out how to create new template files:

http://www.anthrotech.com/...inks/faqs/templates/

This template file should be a copy of your link.html file. The sub that creates the search_link.html file should be called sub site_html_search_link.

3) Then in this new sub-routine (sub site_html_search_link), add the following codes:

Code:
my $printcat = shift;
my $clean_category = &build_clean($rec{'Name'});
$printcat = qq~$clean_category~;

Then define the following tag in this sub:

Code:
printcat => $printcat

4) Then in the new template file (search_link.html) file, add the following codes:

Code:
From category: <%printcat%>

Hope this works for you.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Category display in search In reply to
Sorry...I posted the following wrong codes:

Quote:
I was the LINKS user that couldn't get it to work before.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.




[This message has been edited by AnthroRules (edited April 22, 2000).]
Quote Reply
Re: Category display in search In reply to
Hey Eliot,

I was the LINKS user that couldn't get it to work before.

I tried the solution you posted, but i still get the Unknown Tag error.

Here's a copy of the site_html_templates sub i tried to use.

sub site_html_search_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.

my $printcat = shift;
my $clean_category = &build_clean($rec{'Name'});
$printcat = qq~$clean_category~;

my %rec = @_;

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

return &load_template ('search_link.html', {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
printcat => $princat,
%rec,
%globals
});
}



Any ideas on what im doing wrong?

Many Thanks,

Kingy.