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?


Quote Reply
Re: [jai] Global Subroutine In reply to

Just add 'return;' command at the bottom of subroutine. It should work.



Last edited by:

TheStone: Apr 8, 2002, 10:06 AM