IT[X] external files

From: Date: Fri, 29 Jun 2001 04:45:58 +0000
Subject: IT[X] external files
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-175@lists.php.net to get a copy of this message
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

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