Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.3

Bug #12095 Doesn't cope with plain templates
Submitted: 2007-09-22 03:21 UTC
From: jcnascimento Assigned:
Status: No Feedback Package: HTML_Template_IT (version 1.2.1)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2007-09-22 03:21 UTC] jcnascimento (Jose Carlos N Medeiros)
Description: ------------ This packages refuses to display pages that have no variable replacements in them. This situation might come up with a page that used to have variable replacements but doesn't any more, or one that you plan to have in the future, and just haven't put them in yet. Test script: --------------- Here's what I'm using as a testcase: index.php: <?php require_once "HTML/Template/IT.php"; $tpl = new HTML_Template_IT("./templates"); $tpl->loadTemplatefile("main.tpl.htm", true, true); $tpl->show(); ?> templates/main.tpl.htm: <html> <p>foo</p> </html> This case in fact looks intentionally crippled, with no explanation as to why. This patch removes the crippling. --- /tmp/IT.php 2005-08-02 05:16:43.393968953 -0700 +++ IT.php 2005-08-02 05:28:11.005155573 -0700 @@ -585,10 +585,7 @@ } else { - if (isset($this->touchedBlocks[$block])) { - $this->blockdata[$block] .= $outer; - unset($this->touchedBlocks[$block]); - } + $this->blockdata[$block] .= $outer; }

Comments

 [2007-11-28 18:31 UTC] tallmann (Nate Tallman)
On the loadTemplatefile method, if you set the removeEmptyBlocks boolean to false, the template with no substitutions will show. $template->loadTemplatefile('someTemplate.tpl', true, false); not sure if that's a bug or if that's planned action.
 [2008-01-10 08:08 UTC] najtje (Tomasz Cichecki)
With this patch a lot of my software breaks because I depend on the behaviour that not touched templates doesn't render at all. Even in the documentation it's mentioned but I think it should be stressed that every template has the __global__ block. The documentation says: In IT the whole template file itself is nested in a meta block called "__global__". Most block-related functions use this block name as default. I hope this patch will not be included in the following releases.
 [2008-11-14 01:20 UTC] schagane (Brice Schagane)
Instead of ignoring the touchedBlocks flag, I think this would better suit your problem without affecting other situations: if (isset($this->touchedBlocks[$block])) { $this->blockdata[$block] .= $outer; unset($this->touchedBlocks[$block]); } else { if (($block == '__global__') && (count($this->blocklist) == 1)) { $this->blockdata[$block] .= $outer; } }
 [2009-09-21 05:46 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
carlos says: "Bug #12095 isn“t a bug to me. We can call method loadTemplateFile with params that preserve plain templates $tpl->loadTemplateFile("template.html", true, true);"
 [2010-02-21 17:44 UTC] doconnor (Daniel O'Connor)
-Status: Feedback +Status: No Feedback
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you.