Gossamer Forum
Home : Products : Links 2.0 : Customization :

Hiding links problem

Quote Reply
Hiding links problem
Hello,

I tried to add a new database field calles Status with four possible options Visible,Hidden,Prepared and Deleted. I found a post about that ( http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=209606 ) and did everything.
In the links.def I added in the database definition the following line:
Status => [14, 'alpha', 10, 10, 1, 'Visible', '']

also edited this part:
# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;
$db_status = 14;

Defined system default: Status => 'Visible'

And modified the following code also:
# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
ReceiveMail => 'Yes,No',
Status => 'Visible,Hidden,Prepared,Deleted'
);

My link.html:

<%if (Status eq 'Visible')%>
<dl><dt><strong><a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a></strong>

<%if Description%>
<dd><%Description%>
<%endif%>

<%if isNew%>
<small><sup class="new">new</sup></small>
<%endif%>

<%if isPopular%>
<small><sup class="pop">pop</sup></small>
<%endif%>

<br><small class="date">(Added: <%Date%> Hits: <%Hits%> Rating: <%Rating%> Votes: <%Votes%>) <a href="<%db_cgi_url%>/rate.cgi?ID=<%ID%>">Rate It</a></small>

</dl>
<%endif%>

I wanted to show only the 'Visible' links, but when I generate all pages, the linked title of ALL links are missing. There are only the descriptions. And also the descriptions of the 'Hidden' links. Something like that:

Program to store and easily access addresses and phone numbers. Includes phone dialer.
(Added: 9-Jul-2001 Hits: 1458 Rating: 0 Votes: 0) Rate It Freeware address book replacement for Microsoft Windows 95/98/NT4/2000 and XP. It has many features and tools which make it easy to use, and a simple interface which makes contact management simplified.
(Added: 10-Aug-2003 Hits: 2413 Rating: 0 Votes: 0) Rate It

Does anyone have any idea what can be wrong?

Zdenek
Quote Reply
Re: [Prospector] Hiding links problem In reply to
I don't think you need this line:

Defined system default: Status => 'Visible'


Then change

<%if (Status eq 'Visible')%>

to

<%if Status eq 'Visible'%>

--removed (parenthesis)

Did you update (add a new field to the end of each entry) your links.db?


If still no luck, ask again...


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Dec 5, 2004, 12:07 PM
Quote Reply
Re: [PerlFlunkie] Hiding links problem In reply to
I tried it, but had no luck. But now I have the solution. Maybe someone can use it too, so here is it.

I'm testing the status of link in site_html_templates.pl and not in template link.html. It's quite simple I edited this part in sub site_html_link part:

return &load_template ('link.html', {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
%rec,
%globals
});
my $printcat = shift;
my $clean_category = &build_clean($rec{'Category'});
$printcat = qq~$clean_category~;
}

to:

if ($rec{'Status'} eq 'Visible') {

return &load_template ('link.html', {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
%rec,
%globals
});
my $printcat = shift;
my $clean_category = &build_clean($rec{'Category'});
$printcat = qq~$clean_category~;
}
}

Zdenek
Prospector's free stuff - http://www.prospector.cz/