neroag;10986822 wrote:
we need to import our products from an xml feed
The code you posted isn't (valid) XML.
neroag;10986822 wrote:
, I can read the xml into an multidimentional array from then on im stuck..
If it was (valid) XML, you could use PHP DOM instead of doing things manually.
neroag;10986822 wrote:
what i need is to to loop the whole multidimentional array & output each into varaibles that i can use
If you have it in an array, you allready have a variable you can use.
neroag;10986822 wrote:
ie .. $category_name = $arrXml[CREATED][CATEGORY][0]['@attributes']['name'];
There is no need to assign an array element to a new variable. You will just have the same value in two places, and you are obviously allready accessing this value when you assign it to the new variable.
neroag;10986822 wrote:
but in a loop to display them all
Control Structures, and more specifically, check the entries for "for" and "foreach".
neroag;10986822 wrote:
<STOREITEMS>
<CREATED value="Fri Aug 26 1:01:01 BST 2011">
<CATEGORY name=" > category name" id="69">
<PRODUCT ITEM="1234">
<NAME>PRODUCT TITLE OR NAME</NAME>
<MODEL>MODEL NUMBER</MODEL>
<PRICE>7.00</PRICE>
<RRP>15.95</RRP>
<THUMB>BT2-Ss.jpg</THUMB>
<IMAGE>BT2-S.jpg</IMAGE>
<DESCRIPTION>product description</DESCRIPTION>
<POWER>product power<POWER/>
<SIZE>product dimentions<SIZE/>
<ATTRIBUTES NAME="Size">
<ATTRIBUTEVALUES TITLE="Small" VALUE="16"/>
<ATTRIBUTEVALUES TITLE="Medium" VALUE="17"/>
<ATTRIBUTEVALUES TITLE="Large" VALUE="18"/>
</ATTRIBUTES>
</PRODUCT>
</CATEGORY>
</CREATED>
</STOREITEMS>
XML validation errors
1. You are missing the xml opening tag.
2. Some tags are preceeded by a hyphen (-)
3.Some closing tags are malformed (</endtag> is correct, <endtag/> is not)
<empty_element/> is correct, but that is not an endtag, it's an opening and closing tag for an empty element.