note 95478 added to function.eval
| From: | ajo at NO dot SPAM dot mydevnull dot net | Date: | Tue, 05 Jan 2010 09:15:21 +0000 |
| Subject: | note 95478 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164652@lists.php.net to get a copy of this message | ||
Inspired from the users microvalen at NOSPAM dot microvalen dot com and javis, i combined their
notes and came up with a very simple "template engine", for testing purposes (to save the
time and trouble of downloading and including a real template engine like the Smarty):
<?php
$var = 'dynamic content';
echo eval('?>' . file_get_contents('template.phtml') . '<?');
?>
and the template.phtml:
<html>
<head>
<!-- ... -->
</head>
<body>
<!-- ... -->
<?=$var?>
<!-- ... -->
</body>
</html>
This is something i use a lot (specially when studying new PHP Libraries or trying new jQuery
plugins) and i think it might help others too.
----
Server IP: 85.196.44.41
Probable Submitter: 79.129.45.89
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/95478
Del: integrated -- https://master.php.net/note/delete/95478/integrated
Del: useless -- https://master.php.net/note/delete/95478/useless
Del: bad code -- https://master.php.net/note/delete/95478/bad+code
Del: spam -- https://master.php.net/note/delete/95478/spam
Del: non-english -- https://master.php.net/note/delete/95478/non-english
Del: in docs -- https://master.php.net/note/delete/95478/in+docs
Del: other reasons-- https://master.php.net/note/delete/95478
Reject -- https://master.php.net/note/reject/95478
Search -- https://master.php.net/manage/user-notes.php