Bug #12095 [Opn->Fbk]: Doesn't cope with plain templates
| From: | daniel dot oconnor at gmail dot com | Date: | Mon, 21 Sep 2009 00:46:54 +0000 |
| Subject: | Bug #12095 [Opn->Fbk]: Doesn't cope with plain templates | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-1684@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=12095&edit=1
ID: 12095
Updated by: daniel.oconnor@gmail.com
Reported By: jose at psabs dot com dot br
Summary: Doesn't cope with plain templates
-Status: Open
+Status: Feedback
Type: Bug
Package: HTML_Template_IT
Package Version: 1.2.1
PHP Version: Irrelevant
Roadmap Versions:
New Comment:
-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);"
Previous Comments:
------------------------------------------------------------------------
[2008-11-13 20:20:08] 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;
}
}
------------------------------------------------------------------------
[2008-01-10 03:08:19] najtje
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.
------------------------------------------------------------------------
[2007-11-28 13:31:50] tallmann
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.
------------------------------------------------------------------------
[2007-09-21 23:21:37] jcnascimento
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;
}
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=12095&edit=1