Hey there,
We have a class that sets up a tree structure that represents an e-learning
object made up of nested "components". We have a function
getPropertyValue($name) which returns the property $name for the current
component.
Now, we want to allow the user to use something like {parent.property} in a
property value, so that it can inherit parts of properties from the parent
component. For example: caption = "the name of this component's parent is
{parent.name}!"
The following line sort of works:
$retVal =
preg_replace("/(.*){parent.(.*)}(.*)/e","'\\1'.\$this->parentNode->getProper
tyValue('\\2').'\\3'",$retVal);
However, if there are more than one string to replace it only works on the
last one. So:
caption = "the parent's coordinates are ({parent.left}, {parent.top})" would
only return something like: "the parent's coordinates are ({parent.left},
100)"
Hope someone can help.
Thanks
Dan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php