Gossamer Forum
Quote Reply
Recent 10 links
Anyone working on a recent links display?

The global code sample in the docs can be changed from/to:

$link_db->select_options ('ORDER BY Hits DESC', 'LIMIT 5');
$link_db->select_options ('ORDER BY isNew DESC', 'LIMIT 10');

for a recent 10 links added global.

Ideally, you would be able to call and use a different links.html template for formatting of the output. Don't know how as I'm not a programmer ;-}


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
Quote Reply
Re: Recent 10 links In reply to
Hi,

Thanks for that.

This mod does indeed give a solution, however, I was hoping for perhaps a single global or plugin solution without hacking SiteHtml.pm to survive upgrades etc.

Will use if no other way can be found.

Thanks again :-)

Quote Reply
Re: Recent 10 links In reply to
What's mean -create a global New5-
How I can create a global New5
wich file ???
Thanks
Fabio

Quote Reply
Re: Recent 10 links In reply to
> create a global New5

Means - paste in the code at: Build > Template Globals and call it New5.

;-)

Although the rest of the hack will need to be re-done if you upgrade your
scripts, unless a better way is found.

I'm surprised others haven't asked for this mod, I would think this would be
very useful for most link sites!


- Eraser

Quote Reply
Re: Recent 10 links In reply to
Thanks it's a great mod
Now it's all right
Fabio
Bye from Italy

Quote Reply
Re: Recent 10 links In reply to
I would like to use something like that outside from linkSQL, at my main-homepage.

For example, total numbers of records and title of last 5 added records.

Any ideas?

Michael

Quote Reply
Re: Recent 10 links In reply to
If your site is static, try it with an iframe;
another way (i use) is to let links build another homepage (without the cats and all the things you need)

Robert

Quote Reply
Re: Recent 10 links In reply to
Hi Robert,

I just visited your site to take a look.
Seems to be down, you should reparieren
es bald, then ich komme wieder :)

Michael



Quote Reply
Re: Recent 10 links In reply to
Would anyone out there be able to post the code for a top 10 links output,
im sure it similar to this but i am far from a programmer,

any input would be appreciated,

thanks alot,
recon

Quote Reply
Re: Recent 10 links In reply to
hi
I think the following should do
sub {
# Displays the Newest links.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC Limit 10');
$sth = $search_db->select ( { isNew => 'Yes'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}

Regards
Abd

http://www.idleb.com
Quote Reply
Re: Recent 10 links In reply to
I have a plugin that display top new site and top rate site in the home page. If you are interseted in that pluggin. Please send email to me dainguyen@gossomermail.com to get it.

Regards,

Mark

Quote Reply
Re: Recent 10 links In reply to
That mail will bounce Wink

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Recent 10 links In reply to
Alternative email thanhdai@excite.com.

Regards,

Mark

Quote Reply
Re: [katabd] Recent 10 links In reply to
Just wanted to let you know that it doesn't work.
http://www.FindSP.com - Hosting Directory
Quote Reply
Re: [FindSP.com] Recent 10 links In reply to
What code and tag works with Gossamer Links 3.3.0?
http://www.hopeforyou.com

Quote Reply
Re: [HopeForYou] Recent 10 links In reply to
Try ULTRAGlobals:

Code:
<%Plugins::ULTRAGlobals::Latest_New_Links(5)%>
<%if Latest_Links_Loop.length%>
<%loop Latest_Links_Loop%>
<%include link.html%>
<%endloop%>
<%endif%>

..or:

Code:
<%Plugins::ULTRAGlobals::List_Links('Title',''LIKE','%','Timestmp DESC',10)%>
<%if cond_loop_link.length%>
<%loop cond_loop_link%>
<%include link.html%>
<%endloop%>
<%endif%>

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Recent 10 links In reply to
Andy wrote:
Try ULTRAGlobals:

Code:
<%Plugins::ULTRAGlobals::Latest_New_Links(5)%>
<%if Latest_Links_Loop.length%>
<%loop Latest_Links_Loop%>
<%include link.html%>
<%endloop%>
<%endif%>


..or:

Code:
<%Plugins::ULTRAGlobals::List_Links('Title',''LIKE','%','Timestmp DESC',10)%>
<%if cond_loop_link.length%>
<%loop cond_loop_link%>
<%include link.html%>
<%endloop%>
<%endif%>


Cheers


The ULTRAGlobals plugin is very impressive and probably a classic.

Nice job!
http://www.hopeforyou.com

Last edited by:

HopeForYou: Jun 2, 2009, 7:28 AM