Re: Help ,Question About HTML_Template_Xipe

From: Date: Mon, 12 May 2003 11:43:52 +0000
Subject: Re: Help ,Question About HTML_Template_Xipe
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5321@lists.php.net to get a copy of this message
wingoffire wrote: > I'm a new user of your Xipe,last night I install it and try to run the > demo like below > > > xipe.tpl > <html> > <title>{$title}</title> > <body> > Welcome {$username}! > > You can choose from: > > <!-- > a simple foreach-loop as you know it from PHP > all the indented lines below the foreach-line > are looped (from the <li> to the </li>) > --> > {foreach( $list as $aItem )} > <li> > {$aItem} > </li> > > <br /> > Please don't hesitate to choose the right thing :-) > </body> > </html> > > xipe.php > <?php > // require the engine which is in the include path > require_once ('HTML/Template/Xipe.php'); > // define the options for the template engine > $options = array > ( > // the root-directory where to find the templates > 'templateDir' => dirname(__FILE__), > // the directory where to store the compiled template > 'compileDir' => 'tmp' > ); > // create an instance of the template engine > $tpl = new HTML_Template_Xipe($options); > > // the template file is in the templateDir, the same directory > // as where the php-file is, therefore we only need to give the file name > $tpl->compile('xipe.tpl'); > // this includes the finally compiled template, which is a php-file > $list = array ( 'abc' , 'def' , 'ghi'); > include($tpl->getCompiledTemplate()); > ?> > > then I run it but the result is: > > # Welcome ! You can choose from: > ・ghi > > Please don't hesitate to choose the right thing :-) > > but not > # Welcome ! You can choose from: > ・abc > ・def > ・ghi > > Please don't hesitate to choose the right thing :-) You need to either set autoBraces=false in the options, which means blocks are built the PHP-way, which is: {if (whatever):} do something here {endif} or if you have autoBraces=true (which is not really recommended anymore) you would {if (whatever)} you have to indent the block inside properly to let XIPE build the block automatically so that this is NOT in the block anymore!, because it is not indented With this way you have to watch out for NOT using tabs! the depth of the indention has to be at least one character, better more. -- Wolfram .. opensource @ vision:produktion ... http://opensource.visionp.de .. translating template engine .... http://sf.net/projects/simpletpl .. authentication system .... http://sf.net/projects/auth

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