Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How can I list the "5 newest links"?

Quote Reply
How can I list the "5 newest links"?
I would like to make it so the 5 newest additions to my directory are noted on the front page of my site. As you can see at http://www.scriptz.com, the front page has "5 newest scripts". Can someone tell me please how I could do this? I can't seem to figure it out. Is there a plugin for this? I appreciate all the help everyone has given me so far, these forums are a blessing.



Thanks,

Adam
--------------------
Scripts - Powered by Links-SQL
Quote Reply
Re: [SkuZZy] How can I list the "5 newest links"? In reply to
try these:

http://www.gossamer-threads.com/...orum.cgi?post=242663

http://www.gossamer-threads.com/...orum.cgi?post=187074

http://www.gossamer-threads.com/...orum.cgi?post=239020

http://www.gossamer-threads.com/...orum.cgi?post=228707

http://www.gossamer-threads.com/...orum.cgi?post=171309


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] How can I list the "5 newest links"? In reply to
Thanks alot, it's working now! One thing, how can I display the category which the link is in? I tried "category" and "category_name" .... none work. Any ideas anyone>?
--------------------
Scripts - Powered by Links-SQL
Quote Reply
Re: [SkuZZy] How can I list the "5 newest links"? In reply to
Can you post the global you are using and then someone can suggest the changes you need.
Quote Reply
Re: [afinlr] How can I list the "5 newest links"? In reply to
Here is the global im using:

-----------

sub {
# Displays the newest 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 ( { isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Description} > 220) {
$link->{Description} = substr($link->{Description}, 0, 220) . '...';
}
$output .= Links::SiteHTML::display ('new_links', $link);
}
return $output;
}


---------------------------



I would like to beable to use a <%category%> tag in the "new_links.html" template to display a text version of which category the link is a part of, like "CFML / Web Development / Style Sheets" or something.



Thanks,

Adam
--------------------
Scripts - Powered by Links-SQL
Quote Reply
Re: [SkuZZy] How can I list the "5 newest links"? In reply to
Something like this

sub {
# Displays the newest 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 ( { isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {

$link->{category} = $DB->table('CatLinks','Category')->select(['Full_Name'],{LinkID => $link->{ID}});
if (length $link->{Description} > 220) {
$link->{Description} = substr($link->{Description}, 0, 220) . '...';
}
$output .= Links::SiteHTML::display ('new_links', $link);
}
return $output;
}

Last edited by:

afinlr: May 13, 2003, 8:32 AM
Quote Reply
Re: [afinlr] How can I list the "5 newest links"? In reply to
In Reply To:
Something like this

sub {
# Displays the newest 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 ( { isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {

$link->{category} = $DB->table('CatLinks','Category')->select(['Full_Name'],{LinkID => $link->{ID}});
if (length $link->{Description} > 220) {
$link->{Description} = substr($link->{Description}, 0, 220) . '...';
}
$output .= Links::SiteHTML::display ('new_links', $link);
}
return $output;
}




Doesn't seem to be working... what would I use to call the category? <%Category%> ? It just says same error.
--------------------
Scripts - Powered by Links-SQL
Quote Reply
Re: [SkuZZy] How can I list the "5 newest links"? In reply to
Well, i changed it to <%category%> (small c) and now it shows:



GT::SQL::Driver::MYSQL::sth=HASH(0x85f1b84)



for all the categories.... what the?
--------------------
Scripts - Powered by Links-SQL
Quote Reply
Re: [SkuZZy] How can I list the "5 newest links"? In reply to
Oops, sorry - missed the fetchrow_array off the end.

sub {
# Displays the newest 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 ( { isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
$link->{category} = $DB->table('CatLinks','Category')->select(['Full_Name'],{LinkID => $link->{ID}})->fetchrow_array;
if (length $link->{Description} > 220) {
$link->{Description} = substr($link->{Description}, 0, 220) . '...';
}
$output .= "$link->{category} - $link->{Title}<br>";
}
return $output;
}
Quote Reply
Re: [afinlr] How can I list the "5 newest links"? In reply to
 
I like to add in the detail link along with the category mod. How do i do it?
Quote Reply
Re: [gundamz] How can I list the "5 newest links"? In reply to
i have fix the problem. sorry.
Quote Reply
Re: [gundamz] How can I list the "5 newest links"? In reply to
How did you add the detail link? Someone else might like to add that, too.

Thanks Smile

------------------------------------------