23374 Posts in 18175 Topics by 2866 members
|Go to End|
17 April 2009 at 7:48am Last edited: 17 April 2009 7:48am
I have a variable, $Logo. This is a text string that the user can put in while creating the pages in the admin. However, more than a few times they have inadvertantly filled this with a space character only and so when I call the variable with
<% if Logo %> (Boolean check) then dothis routine the Boolean value is True. How can I create an if statement to check if the variable is set (equal) to a single space character?
I have tried
<% if Logo = " " %>
<% if Logo = ' ' %>
both give me a php error.
17 April 2009 at 8:57am
I guess you can't do that in your template, but you could do a function in your PageName.php file like this:
$result = ($this->Logo == ' ')? True : False;
And then reference to the function in the template like this:
<% if testLogo %>
<% else %>
<% end_if %>
I hope it will help. Cheers!
|Go to Top|