PHP, Smarty and empty if()’s
Posted on December 21, 2003
Filed Under /dev/null/ | 35 views |
I’ve just installed Smarty and it’s all working well save for one issue: all the if () statements in my compiled templates are empty, like so:
<?php if (): echo $this->_tpl_vars['pageTitle'];
else: echo $this->_config[0]['vars']['pageTitle'];
endif; ?>
The template code looks like:
{if $pageTitle}{$pageTitle}{else}{#pageTitle#}{/if}
and I can’t figure out why. Anyone have any suggestions?
Update - vital stats:
- PHP: 4.3.4 (Mark Liyanage’s)
- Smarty: 2.6.0
Comments
3 Responses to “PHP, Smarty and empty if()’s”
Leave a Reply
Just as a debugging tool, what happens if you try:
{if (!empty($pageTitle))} or
{if ($pageTitle == TRUE)}
?
Which version of smarty? Which version of PHP? The built-in php?
Hm, never had a problem like that. Maybe you could post some additional info, versions, config and setup.
What I often find to be helpful is setting up the minimal code that triggers a problem, e.g. extracting your few lines of template code into a separate project, wich minimal config.