Gossamer Forum
Quote Reply
Re: Recent 10 links In reply to
Hi
If I understand your question correctly you will need to :
1- create a new link1.html file and place it in your template folder.
2- modify it the way you which your links to appear.
3- create a global New5:
sub {
# Displays the featured links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC Limit 5');
$sth = $search_db->select ( { isNew => 'Yes'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}
4- in your SiteHtml.pm add the following sub:
sub site_html_link1 {
# --------------------------------------------------------
# Format a New link.
#
my $rec = shift;

# Convert the date formats.
if ($CFG->{date_db_format} ne $CFG->{date_user_format}) {
Links::init_date();
$rec->{Add_Date} = GT::Date::date_transform ($rec->{Add_Date}, $CFG->{date_db_format}, $CFG->{date_user_format});
$rec->{Mod_Date} = GT::Date::date_transform ($rec->{Mod_Date}, $CFG->{date_db_format}, $CFG->{date_user_format});
}

# Set new and pop to either 1 or undef for templates.
(defined $rec->{'isNew'} and ($rec->{'isNew'} eq 'Yes')) ? ($rec->{'isNew'} = 1) : ($rec->{'isNew'} = 0);
(defined $rec->{'isChanged'} and ($rec->{'isChanged'} eq 'Yes')) ? ($rec->{'isChanged'} = 1) : ($rec->{'isChanged'} = 0);
(defined $rec->{'isPopular'} and ($rec->{'isPopular'} eq 'Yes')) ? ($rec->{'isPopular'} = 1) : ($rec->{'isPopular'} = 0);
(defined $Links::USER->{Username} and ($rec->{'LinkOwner'} eq $Links::USER->{Username})) ?
($rec->{'isLinkOwner'} = 1) : ($rec->{'isLinkOwner'} = 0);

# Set the detailed_url.
$rec->{detailed_url} = "$CFG->{build_detail_url}/${$rec}{'ID'}$CFG->{build_extension}";

# Parse the template.
my $output = Links::load_template ('link1.html', $rec, 0);
return $output;
}


Just pass <%New5%> anywhere you want it
and that should do it


Regards
Abd

http://www.idleb.com
Subject Author Views Date
Thread Recent 10 links SamX 14066 Mar 30, 2001, 8:28 AM
Thread Re: Recent 10 links
katabd 13890 Mar 30, 2001, 9:02 AM
Post Re: Recent 10 links
SamX 13846 Mar 30, 2001, 9:38 AM
Thread Re: Recent 10 links
fabio 13835 Apr 3, 2001, 2:08 AM
Thread Re: Recent 10 links
Eraser 13806 Apr 3, 2001, 6:04 AM
Post Re: Recent 10 links
fabio 13761 Apr 3, 2001, 6:58 AM
Thread Re: Recent 10 links
Sir Up 13857 Apr 6, 2001, 1:45 PM
Thread Re: Recent 10 links
Robert 13779 Apr 16, 2001, 12:57 PM
Thread Re: Recent 10 links
Sir Up 13751 Apr 16, 2001, 1:14 PM
Thread Re: Recent 10 links
recon 13622 Aug 17, 2001, 1:48 PM
Thread Re: Recent 10 links
katabd 13538 Aug 24, 2001, 2:28 AM
Thread Re: Recent 10 links
Beck 13530 Aug 24, 2001, 8:32 PM
Thread Re: Recent 10 links
Paul 13585 Aug 24, 2001, 9:01 PM
Post Re: Recent 10 links
Beck 13518 Aug 24, 2001, 9:18 PM
Thread Re: [katabd] Recent 10 links
FindSP.com 12511 Feb 18, 2005, 6:28 AM
Thread Re: [FindSP.com] Recent 10 links
HopeForYou 11966 Jun 1, 2009, 7:59 PM
Thread Re: [HopeForYou] Recent 10 links
Andy 12001 Jun 1, 2009, 11:45 PM
Post Re: [Andy] Recent 10 links
HopeForYou 11969 Jun 2, 2009, 7:26 AM