Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Global to pull the images from certain links.

Quote Reply
Global to pull the images from certain links.
Hi

I'm using the following global to pull the images from certain links.
It works OK but if there are not any images in say Image_3 or Image_4 it shows as a broken image.

What do I need to add or change to make sure it checks if there is an image to load up first.
I have the following in the links table.
Image_1, Image_2, Image_3, Image_4 and they are either gif or jpg.

In select > { Image_1 => 'gif'} ??

sub {
# Displays images.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC','Limit 100');
$sth = $search_db->select ( { LinkType => 'Images'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link_images', $link);
}
return $output;
}

Thanks

Regards

minesite
Quote Reply
Re: [minesite] Global to pull the images from certain links. In reply to
In link_images.html, you should just be able to put some "if" statements around it. i.e;

Code:
<%if Image_2%>
do image_2 stuff
<%endif%>

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!