note 57718 deleted from function.eval by nlopess

From: Date: Wed, 12 Oct 2005 08:44:49 +0000
Subject: note 57718 deleted from function.eval by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-96890@lists.php.net to get a copy of this message
Note Submitter: kalce at web7 dot pl ---- Probably the simplest way to implement templates with using eval(). <?php $code = "return " . "<<<TEMPLATE\n" . str_replace("\r", "", file_get_contents($file_name)) . "\n" . "TEMPLATE;\n"; echo eval($code); ?> In template you have to use heredoc syntax, so you can't use any simple function, but you can use variables, objects and methods. Secure and simple.

« previous php.notes (#96890) next »