|
Posted by Raj on 11/16/51 11:33
Hi,
I am trying to use preg_replace to replace values in a template XML file
with values from an array using the following:
$tmp = preg_replace('/<!-- (\S+) -->/ge', $values[\\1], $line);
The template file will have lines such as:
<image source="pics/<!-- pic1 -->" thumb="pics/<!-- thumb1 -->"
title="<!-- caption1 -->"/>
And the $values array has values:
$values[pic1] = "raj1.jpg"
$values[thumb1] = "traj1.jpg"
$values[caption1] = "Who is this?"
Can anyone see where I am going wrong?
Any help is appreciated...I've been trying different combinations, but I've
not found anywhere which uses an array look-up in the replace parameter.
Thanks in advance!
--
Raj Kothary :: one|concept
Navigation:
[Reply to this message]
|