#20199 [Opn->Csd]: HTML_Template_IT Logic Error

From: Date: Sat, 16 Nov 2002 01:06:11 +0000
Subject: #20199 [Opn->Csd]: HTML_Template_IT Logic Error
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10861@lists.php.net to get a copy of this message
ID: 20199 Updated by: pajoye@php.net Reported By: adam@tux.appstate.edu -Status: Open +Status: Closed Bug Type: PEAR related Operating System: Red Hat 8.0 PHP Version: 4.2.3 New Comment: This is normal. Try this: $tpl = new HTML_Template_IT(); $tpl->setTemplate($template, TRUE, TRUE); $tpl->removeUnknownVariables = false; $tpl->setVariable($vars); $tpl->show(); thanks for the report hth pa Previous Comments: ------------------------------------------------------------------------ [2002-10-31 13:46:33] adam@tux.appstate.edu When assigning a string that contains a "replacement variable"-like sub-string to an actual replacement variable, on IT's next "pass" it will replace the variable-like sub-string with nothing and if this string was contained within a block it will remove the block: Example Lets assume for some unknown reason the programmer wishes to print name like this -> {name} <code> <?php require_once("HTML/IT.php"); $vars["title"] = "Welcome! {Adam}"; $vars["content"] = "This is some content!"; $template = " <!-- BEGIN TITLE --> {title}<br /> <!-- END TITLE --> <!-- BEGIN CONTENT --> {content}<br /> <!-- END CONTENT -->"; $tpl = new HTML_Template_IT; $tpl->setTemplate($template, TRUE, TRUE); $tpl->setVariable($vars); echo $tpl->get(); ?> </code> When the above template and data is processed by IT it will not print the name contained in the string $vars["title"]. I hope this is enough info to figure out what's up :) Adam ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20199&edit=1

« previous php.pear.dev (#10861) next »