Posted by Philip Ronan on 10/26/15 11:33
"Raj" wrote:
> $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?
Try $values['\1'] instead of $values[\\1]. Looks OK otherwise.
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Navigation:
[Reply to this message]
|