HTMP Template Proposal

From: Date: Thu, 22 Mar 2007 11:02:18 +0000
Subject: HTMP Template Proposal
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-45962@lists.php.net to get a copy of this message
Hello, I was looking for a PHP replacement for the php_template extension. The extension is able to parse a nested array in one go. I have written a PEAR class to do this. Usage example: Template file 'page.tpl.htm': <h1>{title}</h1> <table> <tmpl:contacts> <tr> <td>{name}</td> <td>{firstname}</td> </tr></tmpl:contacts> </table> // Set up data array for the page $data = array( 'title' => 'Contacts List', 'contacts' => array( array('name' => 'Doe', 'firstname' => 'John', array('name' => 'Smith', 'firstname' => 'Jane' ) ); // Create an instance of HTML_Template_DD $oTpl = new HTML_Template_DD( ); // Set the template file $res = $oTpl->getTplFile( 'page.tpl.htm' ); // Parse the template $oTpl->parse( $data ); $oTpl->show(); The class has ca. 280 lines of code. I wonder if this is worth proposing as a PEAR class? More infos and download here: https://www.diggin-data.de/wiki/wiki/run.php?iRequest=wiki/ViewPage&iPage=PhpPearHTML_Template_DD Thanks in advance, -- Joachim Werner Wiesbaden, Germany

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