Filter for relativ Pictures

From: Date: Fri, 06 Jun 2003 08:42:58 +0000
Subject: Filter for relativ Pictures
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9653@lists.php.net to get a copy of this message
Hello Smartians ;-), this prefilter could be from interest for you. If your designers keep all pictures in templates/images (or sub) you can parse your template with this filter. For example: <img src="./menu/hover"> for your designers, will be parsed to: <img src="./neotecc/templates/images/menu/hover"> So you can give only-access to the templates directory- in my opinion this makes things a lot easier. If you have suggestions for this filter, please write. This filter requires, that the imagepath of the designer starts with ./ Regards, Chris function editImagePath($tpl_source, &$smarty) { $imagepath="./neotecc/templates/images/"; $pattern = '=(<img\s.+?src\=")(.+?)=i'; $tpl_source = preg_replace($pattern, '\\1'.$imagepath, $tpl_source); $pattern = '=(<(td|tr|body)\s.+?background\=")(.+?)=i'; $tpl_source = preg_replace($pattern, '\\1'.$imagepath, $tpl_source); return $tpl_source; }

« previous php.smarty.general (#9653) next »