Managing vars not assigned

From: Date: Wed, 20 Oct 2004 17:28:10 +0000
Subject: Managing vars not assigned
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11897@lists.php.net to get a copy of this message
Hi all, I'm working on a site that uses Smarty. I've never used before, and get so happy to see how easy and how quick you can build sites and pages that way. I think never would do a new site without using Smarty :) Well, I have a couple of easy questions, and would like to get your opinion about: 1) I'm running the site with PHP 5.0.2. All runs ok, but when you switch reporting_erors to E_ALL | E_STRICT (when debugging). There are just some few things to touch there: Modifiying the files and changing all var declarations to public. With that seems to work perfectly without any problem. Any other thing that I should consider to totally compliant with E_STRICT? (I don't need backwards compatibility as all my servers run PHP 5.0.2). 2) Thats about the templates. I've seen on ones not made by me two ways to check is a template var is empty or not assigned: In some templates there is: {if $varname != ''} do stuff {/if} while in other templates you can see: {if !empty($varname)} do stuff {/if} Wich method is better? I prefer checking for empty($varname) (as normally are vars not being assigned by the script) but want to know if there is some better way to do it. Thanks for any comments, Jordi.

« previous php.smarty.general (#11897) next »