I've been looking through my logs and sometimes I will have a template which may contain code similar to:
- Code: Select all
But in my Controller Action I might not have defined $data['errorMsg'] before calling $this->view()->render('blah', $data); so when the template is compiled and used php will log the warning noting that 'errorMsg was not defined'. Therefore I'm wondering if we should have a check in place for isset(...) ? ... : ''; so it will return an empty string if its not been defined so as to avoide PHP warnings? I know I could avoid having the variables in the template or initialise all of them to '' before hand but I am not sure this is something I want to do in every view...especially if I start updating the templates?