note 71585 deleted from function.preg-replace by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 20:07:12 +0000 |
| Subject: | note 71585 deleted from function.preg-replace by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127713@lists.php.net to get a copy of this message | ||
Note Submitter: alch
----
To use preg replace to replace a string with a file, for instance to make a template class, you
would do something like this...
// Replace the <DYNAMIC BLOCK "page.php"> tags with the desired page
$rep = array("<?","?>","<?php","php?>");
$this->Template = preg_replace("/\<DYNAMIC BLOCK \"(.*?)\"\>/e",
'include($path."blocks/\\1")', $this->Template);
Though I personally haven't figured out how to make the page appear where you call it in a
template instead of on the top of the page