Integrated Template...so close!!
| From: | Adam Morton | Date: | Mon, 16 Sep 2002 15:39:13 +0000 |
| Subject: | Integrated Template...so close!! | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2313@lists.php.net to get a copy of this message | ||
Hello all,
I was working with the Integrated Template stuff some more today and have
been running into some issues. I have been staring at the source for a
while now and trying to find the easiest way to use this awsome class. I
found that the following block of code is by far the easiest way to
process a template with a minimal amount of information:
[code]
$tpl = new IntegratedTemplate("your/template/directory");
$tpl->loadTemplatefile("your_template", true, true);
$tpl->setVariable($var_assoc_array);
$tpl->show();
[/code]
However, I still run into the problem of passing $var_assoc_array with all
the values set to NULL. The browser just sits there and processes it for
as long as you allow (or until timeout). I tried setting
$tpl->clearCacheOnParse = true, but then only the outer most block is
replaced correctly and the rest are stripped out.
It seems that the main function parse() kills the variableCache before it
is able to do all of it's replacements. I could write my own loop that
replaces the individual blocks within the template one at a time and
everything works fine, but I feel like I'm re-doing what Ulf has already
done.
Any help here would be much appreciated!! Great work everyone!!
Adam
PS- In the function findBlocks() the blocklist that is returned is
incomplete. Adding $blocklist[] = $name on line 759 seems to have fixed
it for me.
---------------------------------
Adam Morton
Developer - Web Technology Group
Appalachian State University
http://phpwebsite.appstate.edu
adam@tux.appstate.edu