I am developing a system that dynamically reads XML text into a number of Object string attributes. The strings selected will vary depending on a number of external variables (e.g. company & product selected).
It also requires that this code contains some further variable text that has been previously (but dynamically) defined in another Object.
It would be excellent if this XML could contain small PHP scripts that are parsed either during or shortly after the XML element is retrieved.
Example of what I'd like to do. Take this XML (I've invented this, but it demonstrates the sort of thing I need to do):
[HR][/HR]
<?xml version="1.0" encoding="ISO-8859-1" ?>
<Category id="widgets">
<English>
<Products>
<Product id="0012345">WhizzBang RX4556 Undercounter Freezer is a superb addition to your food storage appliances and we currently have <?php $StockControl->stockCount[0012345]; ?> in stock. With 100 litres capacity it will store a large amount of food. This food will be stored in unbeatable 4* freezer rating meaning the stored food will remain fresher for longer. With 3 compartments there is plenty of storage seperation for things such as your meat, vegetables and other groceries that require freezing. You can also quickly freeze your new groceries with the fast freeze feature.</Product>
</Products>
</English>
</Category>
[HR][/HR]
To create this in an Object attrribute using xPath code like this:
[HR][/HR]
$Recs = $xPath->query( "/Category /English/Products/Product[@id='0012345']" );
if (!is_null($Recs))
{
$x = 0;
foreach ($Recs as $Rec) // There can only be one!
{
$this->Prod[$x] = $Rec->textContent;
$x++;
}
}
[HR][/HR]
So that $this->Prod[$x] = "WhizzBang RX4556 Undercounter Freezer is a superb addition to your food storage appliances and we currently have 213 in stock. With 100 litres capacity it will store a large amount of food. This food will be stored in unbeatable 4* freezer rating meaning the stored food will remain fresher for longer. With 3 compartments there is plenty of storage seperation for things such as your meat, vegetables and other groceries that require freezing. You can also quickly freeze your new groceries with the fast freeze feature."
So, does anyone know how I can embed small php scripts into XML (as shown above) in a way that actually works (i.e. parses the php while creating the string)?
Any tips greatly appreciated!