[PHPTAL] not set variable causes errors

Joshua Paine lists at fairsky.us
Thu Jun 14 14:53:22 CEST 2007


Mynthon wrote:
> if i use variable that is not set phptal shows error. I think that not
> set variable should be treated as empty string. Or maybe there is an
> option i missed?

That's correct behavior according to TAL specs. You can get silent error 
handling this way: <b tal:content="boldtext | nothing" />. It's the " | 
nothing" that tells TAL there's another option (though it's nothing) 
available for this value, so don't freak out if the first one's missing.

> and what about direct access to superglobal variables?

I have my own class that extends PHPTAL, and it automatically sets 
req/post, req/get, req/cookie and a few others.

-- 
Joshua Paine
Chief Tower Builder
LetterBlock Software
http://letterblock.com/



More information about the PHPTAL mailing list