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

Custom field "localfile" in Global

Quote Reply
Custom field "localfile" in Global
I need a global to show a custom field i added to the links table.

Im new to this so bear with me. :)

The field is called "localfile" inside the links table, i need a global that shows the Title linked to the "localfile" field instead of the URL (which will be null when localfile is not null).

The localfile field is sometimes EMPTY (null) so also need to validate when localfile is <>''.

The global will be used to show the latests "localfiles" (top10 by add date desc)

Thanks in advance, Rob
Quote Reply
Re: [GTRaptor] Custom field "localfile" in Global In reply to
I just created a global but it is not working right.

Even though im searching where localfile is not NULL, im getting a resultset were the localfile is null...whats wrong with the syntax?

sub {
# Displays NEW TECH links .
my ($output,$sth,$link);
my $id = shift;
my $db = $DB->table ('Links');
$db->select_options ('ORDER BY ADD_DATE DESC', 'LIMIT 5');
require GT::SQL::Condition;
my $cond = GT::SQL::Condition->new( 'localfile', 'IS NOT', \'NULL');
my $sth = $db->select ($cond);
my $premium;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('linx', $link);
}
return $output;
}
Quote Reply
Re: [GTRaptor] Custom field "localfile" in Global In reply to
Solved, had to use <> '' instead of not null