Gossamer Forum
Home : Products : Links 2.0 : Customization :

modify links in search results

Quote Reply
modify links in search results
Hello Smile

I modified this sub assuming this should change any link in 'LINKS' but unfortunately I found that it doesn't work for links coming up with search results.

file: site:html_templates.pl

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

my $template_link;
if ($category_name =~ "category1") {
$template_link = "link-cat1.html";
}elsif ($category_name =~ "category2") {
$template_link = "link-cat2.html";
}elsif ($category_name =~ "category3") {
$template_link = "link-cat3.html";
}else { $template_link = "link.html"; }

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 ($template_link, {

-----

Quote Reply
Re: modify links in search results In reply to
You can try a couple things:

1) Copy the codes you have in the sub site_html_link routine into the sub site_html_search_results routine in your site_html_templates.pl file.

OR

2) Edit the following lines in search.cgi file:

Code:
# Build the HTML for the category results and store it in "$category_results". Only build the html
# if we are on the first set of link results.
foreach $category (@category_results) {
if ($nh == 1) {
$cat_clean = &build_clean($category);
$linked_title = &build_linked_title ($category);
$category_results .= qq|<li>$linked_title\n|;
}
# Go through the hash just built, and build the complete link output. Store in $link_results.

foreach $setoflinks (sort keys %link_output) {

$cat_clean = &build_clean ($setoflinks);
$title_linked = &build_linked_title ($setoflinks);
$link_results .= qq|<P>$title_linked\n|;
$link_results .= $link_output{$setoflinks};

You will have to also edit the $link_output and $title_linked variables.

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited September 06, 1999).]
Quote Reply
Re: modify links in search results In reply to
what i would do...

move those lines under the my %rec = @_; thingy..

and then add this below my %rec = @_;..

Code:
$category_name &#0124; &#0124;= $rec{'Category'};

delete the space between "&#0124; &#0124;".. added by freakin UBB..

jerry

[This message has been edited by widgetz (edited September 06, 1999).]
Quote Reply
Re: modify links in search results In reply to
Hi!
unfortunately both solutions did not work.

Eliot solution: I don't undertand perhaps I made a mistake. I copied

my $template_link;
if ($category_name =~ "category1") {
$template_link = "link-cat1.html";
}elsif ($category_name =~ "category2") {
$template_link = "link-cat2.html";
}elsif ($category_name =~ "category3") {
$template_link = "link-cat3.html";
}else { $template_link = "link.html"; }

into search_results sub.
...then I did not get the <b>difference in the code</b> you told me I should edit in search cgi.
Can you tell me more? please!
--------
widgetz: I also tried your solution but the result is always the same. <b>link.html is the file printed in any case</b>

Thanks for your help.
Quote Reply
Re: modify links in search results In reply to
<b> is bold. isn't it? sorry for using it.
Quote Reply
Re: modify links in search results In reply to
you have categories called "category1", "category2", "category3"? Smile

jerry
Quote Reply
Re: modify links in search results In reply to
Actually to bold characters in UBB, you use (with no spaces between []).

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: modify links in search results In reply to
It works this way:

----
my %rec = @_;

my $template_link;
if $rec{'Category'} =~ "category1") {
$template_link = "link-cat1.html";
}elsif ($rec{'Category'} =~ "category2") {
$template_link = "link-cat2.html";
}elsif $rec{'Category'} =~ "category3") {
$template_link = "link-cat3.html";
}else { $template_link = "link.html"; }

---

Thanks. Smile