Gossamer Forum
Home : Products : Gossamer Links : Discussions :

New Links / Latest Links

Quote Reply
New Links / Latest Links
Any suggestions on how to do this please?

I would like to be able to show a list of new links on a single page, not for a single day but for a period of time, eg list of links covering the last 14 days, formatted like the 'New Links' pages but all listed on 1 page.

The idea is to incorporate this list onto my sites homepage.

Thanks
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
At its simplest, make a new global (get_new_links);

Code:
sub {

my $tbl = $DB->table('Links');
$tbl->select_options('ORDER BY Add_Date');

my $sth = $tbl->select ( { isNew => 'Yes' } ) || die $GT::SQL::error;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {

if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }

if ($hit->{isNew} eq "Yes") { $hit->{isNew} = 1; } else { $hit->{isNew} = 0; }
if ($hit->{isPopular} eq "Yes") { $hit->{isPopular} = 1; } else { $hit->{isPopular} = 0; }
if ($hit->{isChanged} eq "Yes") { $hit->{isChanged} = 1; } else { $hit->{isChanged} = 0; }

push @loop, $hit;
}

return { new_loop => \@loop }

}

..call with:

Code:
<%get_new_link%>
<%loop new_loop%>
<%include link.html%>
<%endloop%>

Untested, but should work.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Andy

that looks great, will try it out ASAP

What about adding 'Priority Listings' to this?

thanks
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Hi,

Quote:
What about adding 'Priority Listings' to this?

Not sure how easy/possible this would be - as the priority listings are *only* identified by looking at their table (not the Links table), so wouldn't be easy to get them in one query.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Thinking about it, if you have ULTRAGlobals installed - then you can just use this:

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

(replace 5 with the number of new links you wanna grab). If you wanna get all new listings , then set to a really high number - i.e 100, and that should work fine =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] New Links / Latest Links In reply to
Andy

that works OK, Thanks.

Ideally, it would be nice to have an option or alternative use for this to display 'Priority Listings'?

Would be great selling point for Priority Listings, if they were 'featured' on the homepage + in their categories?

Could this be done?

Thanks
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Hi,

Quote:
that works OK, Thanks.

No problem =)

Quote:
Ideally, it would be nice to have an option or alternative use for this to display 'Priority Listings'?

Would be great selling point for Priority Listings, if they were 'featured' on the homepage + in their categories?

D you mean you want a global to show priority listing on the homepage? i.e a global to grab them, and give you a look to show?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] New Links / Latest Links In reply to
Andy

yes, I think it could help sell 'priority listings'.


thanks
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Hi,

This should work (untested)

get_priority_links

Code:
sub {

my $tbl = $DB->table('PriorityLinks');
# $tbl->select_options('ORDER BY Add_Date')

my $sth = $tbl->select ( ) || die $GT::SQL::error;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {

my $hit = $DB->table('Links')->get( { ID => $hit->{LinkID} } );

if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }

if ($hit->{isNew} eq "Yes") { $hit->{isNew} = 1; } else { $hit->{isNew} = 0; }
if ($hit->{isPopular} eq "Yes") { $hit->{isPopular} = 1; } else { $hit->{isPopular} = 0; }
if ($hit->{isChanged} eq "Yes") { $hit->{isChanged} = 1; } else { $hit->{isChanged} = 0; }

push @loop, $hit;
}

return { priority_loop => \@loop }

}

Code:
<%get_priority_links%>
<%loop priority_loop%>
<%include link.html%>
<%endloop%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] New Links / Latest Links In reply to
Andy

I've tried the 'Latest_New_Links' plugin from ULTRAGlobals, which works great, can this be used in conjunction with the suggested code for 'get_priority_links' global?

Hopefully producing a list showing 'Priority Links' then 'Latest Links'

I thought it best to ask before 'jumping in'

Thanks
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Hi,

The only real way of "interlinking" them, is by having both on the same page.

i.e:

Code:
get_priority_links
ULTRAGlobals (new links function)

Obviously this won't "merge" the loops - but it should be possible to make them at least look like they are on the same list :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] New Links / Latest Links In reply to
Andy

the aim would be to have the 'prioirty links' listed first, then followed by 'latest links' on the homepage.

Would this be acheived by using the code like this?

<%get_priority_links%>
<%loop priority_loop%>
<%include link.html%>
<%endloop%>
<%Plugins::ULTRAGlobals::Latest_New_Links(25)%>
<%if Latest_Links_Loop.length%>
<%loop Latest_Links_Loop%>
<%include link.html%>
<%endloop%>
<%endif%>
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Hi,

Yup, that should work fine Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] New Links / Latest Links In reply to
Andy

I tried this, appeared to work, looked good (I remembered to add the div class for priority)

Except when I 'clicked' on the 'prioirty listing' it went to a page error 404

The link / url should have gone to a Detailed page, but the 'Detailed' part of the url was missing.

mywebsite.com/England/Cornwall/Advertise_......

mywebsite.com/Detailed/England/Cornwall/Advertise_.....
Colin Thompson
Quote Reply
Re: [colintho] New Links / Latest Links In reply to
Can you email me a link, where I can see this?

This bit should create the detailed_url tag correctly:

Code:
if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!