Gossamer Forum
Quote Reply
if then syntax in Global
Hi everybody

i am using the following Global to create a second Category page with Pagebuiler plugin

Is there any possibility to check if the field Image in the Links Table is empty

i don't know the syntaxFrown

like if image =""

then

$output .= qq~<tr><td width="70" rowspan="2"><img border="0" img src="/images/empty.gif" width="70"></td>
<td width="50%"><a href="$detailed_url"><b>$link->{'Title'}</b></a></td>
<td width="50%"><a href="$CFG->{build_root_url}/$category_url/">$link->{'Name'}</a></td></tr>

else

$output .= qq~<tr><td width="70" rowspan="2"><img border="0" img src="$link->{'image'}" width="70"></td>
<td width="50%"><a href="$detailed_url"><b>$link->{'Title'}</b></a></td>
<td width="50%"><a href="$CFG->{build_root_url}/$category_url/">$link->{'Name'}</a></td></tr>

the check must be in the global and not in template

please help

Wink Marina


The Global:

sub {
my $tags = shift;
my $cat = $tags->{'Full_Name'};
my $output;
my $sth;
my $link;

use GT::SQL::Condition;

my $search_db = $DB->table('Links','CatLinks','Category');
$search_db->select_options ('GROUP BY LinkID ORDER BY Add_Date DESC Limit 10');
$sth = $search_db->select (['Links.ID', 'Links.Description', 'Links.Title', 'Links.image', 'Category.Full_Name', 'Category.Name'], GT::SQL::Condition->new(['Full_Name', 'LIKE', $cat .'%'], ['isValidated', '=', 'Yes']));

while ($link = $sth->fetchrow_hashref)
{
# Set the category url
my $category_url = $DB->table('Category')->as_url($link->{'Full_Name'});

$output .= qq~<tr><td width="70" rowspan="2"><img border="0" img src="$link->{'image'}" width="70"></td>
<td width="50%"><a href="$detailed_url"><b>$link->{'Title'}</b></a></td>
<td width="50%"><a href="$CFG->{build_root_url}/$category_url/">$link->{'Name'}</a></td>
</tr>
~;
}

return $output;
}
Subject Author Views Date
Thread if then syntax in Global mkoenig 2846 Oct 13, 2003, 1:48 AM
Thread Re: [mkoenig] if then syntax in Global
Andy 2762 Oct 13, 2003, 1:51 AM
Thread Re: [Andy] if then syntax in Global
mkoenig 2756 Oct 13, 2003, 1:56 AM
Thread Re: [mkoenig] if then syntax in Global
Andy 2754 Oct 13, 2003, 2:03 AM
Thread Re: [Andy] if then syntax in Global
mkoenig 2746 Oct 13, 2003, 2:14 AM
Thread Re: [mkoenig] if then syntax in Global
Andy 2742 Oct 13, 2003, 2:30 AM
Post Re: [Andy] if then syntax in Global
mkoenig 2754 Oct 13, 2003, 3:06 AM