note 71585 added to function.preg-replace

From: Date: Wed, 06 Dec 2006 22:49:59 +0000
Subject: note 71585 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-120351@lists.php.net to get a copy of this message
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 ---- Server IP: 66.163.161.117 Probable Submitter: 63.229.234.126 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/71585 Del: integrated -- https://master.php.net/note/delete/71585/integrated Del: useless -- https://master.php.net/note/delete/71585/useless Del: bad code -- https://master.php.net/note/delete/71585/bad+code Del: spam -- https://master.php.net/note/delete/71585/spam Del: non-english -- https://master.php.net/note/delete/71585/non-english Del: in docs -- https://master.php.net/note/delete/71585/in+docs Del: other reasons-- https://master.php.net/note/delete/71585 Reject -- https://master.php.net/note/reject/71585 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120351) next »