Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Featured Links on Homepage

Quote Reply
Featured Links on Homepage
Hi,

I'd like to put some featured links on my homepage. I found a great thread in here , that did it, but I am tryng to modify it so it goes 3 columns across.
I have the links going 3 columns across in my categories, but when I try to do it on my homepage it messes up all the tables.

So, now I trying to do it in the globals alone and it's still not working, here is what I have:


Code:



sub {
my $link_db = $DB->table('Links');

$link_db->select_options ("ORDER BY rand()","LIMIT 12");
my $sth = $link_db->select ({isFeature => 'yes', isValidated => 'Yes' });
my $output;
while (my $link = $sth->fetchrow_hashref){
$output .= Links::SiteHTML::display ('homepagelink', $link), Links::Utils::column_split($links_loop.length, '3');
}
return $output;
}

any help would be much appreciated
Quote Reply
Re: [shimmy1] Featured Links on Homepage In reply to
I think you may find it better to do it with a loop, so:

get_the_feature
Code:
sub {
my $link_db = $DB->table('Links');
$link_db->select_options ("ORDER BY rand()","LIMIT 12");
my $sth = $link_db->select ({isFeature => 'yes', isValidated => 'Yes' });
my @loop;
while (my $link = $sth->fetchrow_hashref){
push @loop, $link;
}
return { feature_loop => \@loop } ;
}

Then in your template, have:

Code:
<%~set split = Links::Utils::column_split($feature_loop.length, 3)%>

<%loop feature_loop%>
<%~set splitmod = $row_num % $split%>
<%~if row_num == 1 or splitmod == 1 or split == 1%><dl><%endif%>
<%~include homepagelink.html%>
<%~if row_num == $feature_loop.length or splitmod == 0%></dl><%endif%>
<%~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!

Last edited by:

Andy: Mar 5, 2010, 7:48 AM
Quote Reply
Re: [Andy] Featured Links on Homepage In reply to
Hi,

Thanks, but it's not working yet. There are no errors, it just doesn't show anything at all Frown
Quote Reply
Re: [shimmy1] Featured Links on Homepage In reply to
Sorry,forgot to tell you to add this code BEFORE that loop template code I gave you:

<%get_the_feature%>

Also, I renamed the global (as there was a typo in it :))

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] Featured Links on Homepage In reply to
thanks,

Ok I added <%get_the_feature%> before the template code, and renamed my global.

I now get this error...

Unable to compile 'get_the_feature': No such class link at (eval 19) line 5, near "; my link" syntax error at (eval 19) line 5, at EOF Global symbol "@loop" requires explicit package name at (eval 19) line 7. Global symbol "@loop" requires explicit package name at (eval 19) line 9.
Quote Reply
Re: [shimmy1] Featured Links on Homepage In reply to
Please try the modified version. Was an error :)

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] Featured Links on Homepage In reply to
hi, okay got a different error:

Unable to compile 'get_the_feature': Global symbol "@loop" requires explicit package name at (eval 19) line 7. Global symbol "@loop" requires explicit package name at (eval 19) line 9.
Quote Reply
Re: [shimmy1] Featured Links on Homepage In reply to
Oops, please replace:

my @link

with:

my @loop

Stupid error Tongue (should reallly not try and multi task ;))

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] Featured Links on Homepage In reply to
hmmm, did the change and now there's no more errors, but it is blank again
Quote Reply
Re: [shimmy1] Featured Links on Homepage In reply to
Ah, looks like an error in the template code:

<%loop feature_loop>

Change to:

<%loop feature_loop%>

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] Featured Links on Homepage In reply to
THANK YOU!!!!!!!!!!
works great!
Quote Reply
Re: [shimmy1] Featured Links on Homepage In reply to
Cool - got there in the end Cool

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!