Gossamer Forum
Quote Reply
Variable is not scalar
I have this global that returns the category name on the details page. If I call with a GT filter tag I get an error. How can I fix this please?

<%ucfirst Cat_Name%>

sub {
my $tags = shift;
my $id = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
$db->select_options('LIMIT 1');
my $catid = $db->select ( { LinkID => $id }, ['Name'] )->fetchrow_array;
$catid =~ tr/A-Z/a-z/;
return $catid;
}


RETURNS:

Error: Variable 'Cat_Name' is not scalar

--------------------------------
Privacy Software
Quote Reply
Re: [BLOOD] Variable is not scalar In reply to
I think you are hitting some not so subtle bugs/quriks of the template tag passing system.

Check out:
http://www.gossamer-threads.com/....0.0_Beta_1_P277856/

for the updated syntax for accessing the tags. You can't assume they are going to be the first parameter of the subroutine.


If ucfirst is the name of that function,

<%set Variable = ucfirst($Cat_Name)%>

might work. if <%Cat_Name%> is a tag in your template.

Or, <%ucfirst($Cat_Name)%>

if you just want it returned in place.

Check the template tutorial for the proper calling conventions.

The way you have it shown in your message, is that you are trying to assugn "Cat_Name" to $tags.

You might fix this up, possibly by changing the first line of the sub to:

my $tags = GT::Template->vars;

and calling it with just:

<%ucfirst%>

Just a few thoughts.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [BLOOD] Variable is not scalar In reply to
Try using

<%set temp=$Cat_Name%>
<%ucfirst temp%>

Last edited by:

afinlr: Feb 17, 2006, 4:06 AM
Quote Reply
Re: [BLOOD] Variable is not scalar In reply to
Thanks, I'll give these a try.

--------------------------------
Privacy Software