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

if Conditions in Categories/Sub Categories Global?

Quote Reply
if Conditions in Categories/Sub Categories Global?
Greetings All!

I have a number of custom fields in the Links Table (as well as others), and I am trying to work out how to implement a <%if abc eq 'Yes'> etc test, however am having some difficulty in doing this. I will try and explain.

I have against every link a field 'isPick'. These are my 'Recommended Programs'. In some categories I do not have ANY recommended programs - and here lies my problem. I do not want to display a box titled 'Recommended Programs' on pages where there are no recommendations!

I have tried <%if isPick eq 'Yes'> however this does not work (and I didn't think it would, as it relates to the specific link).

I imagine a global would be the way to start but am unsure of the starting point. I would be interested in this condition checking both the current category and child categories (however would be happy with a simple start - and then I could play with it a little).

Any help would be GREATLY appreciated.



Regards,



Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] if Conditions in Categories/Sub Categories Global? In reply to
If you goto Database > MySQLMan > Launch MySQLMan > prefix_Links, and then see what value is held under isPick. Is it a number, or words? i.e 0/1 No/Yes? Depending on which one it is could decide why the tag is not working right....

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: [Clint] if Conditions in Categories/Sub Categories Global? In reply to
Hi Clint,

Try starting with this global:

sub {
my $tags = shift;
my ($all_ids,@list,$output);
my $cat_id = $tags->{'ID'};
$all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY Add_Date DESC LIMIT 5");
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','isPick','=','Yes','CategoryID', 'IN', \@$all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
push @list, $link;
}

foreach my $link (@list) {
$output .= Links::SiteHTML::display ('link', $link);
}

return $output;
}
The UK High Street