Gossamer Forum
Home : Products : Links 2.0 : Customization :

Special link output

Quote Reply
Special link output
Hi there,

I think this is a simple question but I just can't figure it out as I am new to cgi.

I have seen the code for the Yahoo template mod but that mod is having very limited link for the "inside" or "special" link in the template.def. I wish to have those links it in the links.db.

I have added a field in my link.def for "inside". My site also provides inside comprehensive content in addition to website link added to my database. Thus if it is my own link, I will mark the "inside" as "Yes".

The problem is how can I get this done in the building of the category.html page.

I want the links mark with "Yes" for the "inside" field to be printed first and then the rest of the link but with a horizontal link separating them. Not the sorting problem.


.......
Inside Content

Title
Description
URL

Title
Description
Url

________________________________________________________
WWW Site

Title
Description
Url

Title
Description
Url

........

I know I have to change the code in the db_util.pl (sub build_sorthit) or the nph_build.cgi (sub build_category_pages).

I have added in the link.def

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_inside = 8;

and tried changing this in the sub build_category_pages of nph_build.cgi

for ($i = 0; $i < $build_links_per_page; $i++) {
%tmp = &array_to_hash ($i, @{$links{$cat}});
$links .= &site_html_link (%tmp);

to

for ($i = 0; $i < $build_links_per_page; $i++) {
%tmp = &array_to_hash ($i, @{$links{$cat}});
if ($db_inside eq "Yes") {
$links .= "<h4>Inside Content</h4>\n";
$links .= &site_html_link (%tmp);
$links .= "<hr size=1 noshade>\n";
}
else {
$links .= "<h4>WWW Site</h4>\n";
$links .= &site_html_link (%tmp);
}


but all the link irregardless whether it is "Yes" or "No" is build as follows:

WWW Site

Title
Description
URL

WWW Site

Title
Description
Url

......

Any advice and help is much appreciated. Thank you in advance. Frown