On 08-10-2008 at 15:57:51 admi <[EMAIL PROTECTED]> wrote:
This is example code:
$t = new Tal();
$t->title = "TitleTest";
$t->content = "ContentText";
$t->execute(); //here $t->content should be unset
$t->execute(); //I'd like to have only $t->title
I'd like to delete/unset fields that have been used in current template
(content.html) while calling execute().
Does anyone know where I can do this?
I'm not sure what you're trying to achieve.
If you just want to unset some variables, then $t->content = NULL; should
be good enough.
You don't need to worry about local variables in templates - they're not
preserved (i.e. tal:define="title 'blah'" won't affect $t->title).
If you set global variables in templates, then you could create a "backup"
copy of PHPTAL object like this (I haven't tested this one):
$tal = new PHPTAL();
$tal->title = "TitleTest";
$freshtalcopy = clone $tal; // create copy of PHPTAL with all variables
$tal->content = "ContentText";
$tal = $freshtalcopy;
PHPTAL mailing list