woozy Posted November 10, 2006 Share Posted November 10, 2006 After much struggling where !!!none!!! of my blocks were being parsed, I finally discovered they were parsed if I set a variable.For example:I had a template file called "foo.tmp" consisting of:<html><body>Hello<br>{PAGE_BODY}</body></html>A template scrap file called "goo.tmp" consisting of:<h1>HELLO</h1>and the php file consisting of <?phprequire_once "HTML/TEMPLATE/ITX.php";$template = new HTML_TEMPLATE_ITX(".");$template->loadTemplatefile("foo.tmp");$template->addBlockFile("PAGE_BODY", "pageBody", "goo.tmp");$template->setCurrentBlock("pageBody");$template->parseCurrentBlock();$template->show();?>The page would utterly blank and no error would be registered in the server log.BUT if I edited the php script to have......$template->setCurrentBlock("pageBody");$template->setVariable("GLOM", "whatever");$template->parseCurrentBlock();....THEN the page would render. So... you can't just parse a block without setting a variable????? Any way around this? Link to comment https://forums.phpfreaks.com/topic/26780-pear-html_template_itx-only-parses-a-block-if-you-set-a-variable/ Share on other sites More sharing options...
woozy Posted November 11, 2006 Author Share Posted November 11, 2006 Okay figured it out.Use$template->touchBlock("pageBody");to display the block but don't replace variables. Gets a bit complicated though. If you touch it, you don't want to parse it later or it gets outputted twice. I think this is Okay. I think if you replace a variable but not parse but touch the block later it comes out the same... I hope. Link to comment https://forums.phpfreaks.com/topic/26780-pear-html_template_itx-only-parses-a-block-if-you-set-a-variable/#findComment-122988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.