Re: IT[X] external files

From: Date: Sat, 30 Jun 2001 16:35:09 +0000
Subject: Re: IT[X] external files
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-177@lists.php.net to get a copy of this message
Hello, Why not use Smarty instead, its PEARized.. and not broken ;-)) Luc At 14:37 30/06/01 +0200, Bertrand Mansion wrote:
Hi Graeme, Ulf told me a few weeks ago that the code of IT[X] was broken, especially the addBlock stuff. I don't understand why it is not in Experimental as it is not working, I have lost precious time trying to make it work just like you did... Anyway, if you have some suggestion on fixes, feel free to contribute. Good luck Bertrand le 29/06/01 6:45, Graeme Merrall à graeme@inetix.com.au a écrit : Hi. I'm trying to move some code across to use PEAR to see how it goes. The DB stuff has been fine but I'm having some trouble moving over to using IT[X] and I'm running into a few problems. Previously, I've been using CachingFastTemplates and IT[X] looks very similar. I can reuse the existing tags without any problems except for pointers to external files. For example, "index.tpl" contains: <html> <body> {NORMAL} <P> {EXTERNAL} </body> </html> and in "external.tpl": Hello {NAME} this is a test Then in code: require_once("class.FastTemplate.php"); $tpl = new FastTemplate("."); $tpl->define( array(main => "index.tpl", external=>"external.tpl") ); $tpl->assign( "NORMAL", "testing 1 2 3" ); $tpl->assign( "NAME", "Your Name" ); $tpl->parse ( EXTERNAL, "external" ); $tpl->parse( MAIN, array("external", "main") ); $data = $tpl->FastPrint(); echo $data; to get the result: testing 1 2 3 Hello Your Name this is a test Basically, I want to be able to include the contents of an external file where {EXTERNAL} resides and optinally replace content in the external file as well.
From muddling round in the IT[X] code I can use addBlock but because __global__
is the only block defined and blocks are defined using <!-- BEGIN --> and <!-- END -->, it doesn't work as it should. Is such a thing possible using IT[X]? Additionally, is there a compliment to $tpl->define_dyanmic()? Regards, Graeme Merrall .net


« previous php.pear.general (#177) next »