Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Global Subroutine

Quote Reply
Global Subroutine

I'm trying to get a Template Global to return a new tag without displaying anything on my html page but unless I add a second if condition in the sub it always prints the result on my page.

In my footer.html I have the following -

<!--look for record-->

<!--if we find a record-->
<%if record_search eq 'yes'%>

do somthing....................


In my Template globals I have a Code named "record_search" with the following sub in the Description -

sub {
my $tags = shift;
my ($record_search) = $DB->table('contact')->select({'contact_id' => $tags->{Username} }, ['contact_id'])->fetchrow_array();
if ($record_search){
if ($record_search eq""){

All I am trying to do is set the value of <%record_search%> to 'yes' if the sql query finds a record and then do something. I DONT want it to print 'yes' on my html page!! I have tried an else condition but it doesn't seem to make any difference.

By adding the second if condition, I have solved the problem but I'm sure there is a better way.

Can anyone help?


Subject Author Views Date
Thread Global Subroutine jai 2193 Apr 8, 2002, 6:20 AM
Post Re: [jai] Global Subroutine
604 2102 Apr 8, 2002, 9:29 AM