[pmwiki-devel] Stumped on string insertions...
The Editor
editor at fast.st
Fri Apr 6 08:08:32 CDT 2007
In working on ZAPcart, I got a bit stumped in trying to make it
significantly more configurable. Essentially, rather than hardcoding
the order form, I'm moving the sections out to SDV vars. Like this
for example:
SDV($ZAPorderrows, '<tr><td
nowrap>$itemname </td><td><input type=text size=4
name=$itemlabel value=$itemqty
onblur=calculate()> at</td><td
align=right>$itemprice </td><td><input type=text size=7
name=$itemlabel value=$itemcost onblur=calculate()
onFocus=blur()></td></tr>');
Then somewhere in the markup for the form I want to be able to do
something like this (within a foreach loop):
$orderrows .= $ZAPorderrows;
However I need to be able to replace the variables like $itemname and
$itemlabel with their current value at that time. I can't seem to get
the right combination of ' " etc to make this work. Can someone
suggest something?
I don't want to use eval if possible.
I also tried replacing all the $vars with {vars} and then do
$orderrows .= preg_replace('/\\{(\\w+)\\}/e', "$$1", $ZAPorderrows);
but that didn't sem to work either. Help?
Cheers,
Dan
More information about the pmwiki-devel
mailing list