Xml query
Re: Xml query
You can use XML Made Simple.
It will generate an "SimpleXML" Object (http://php.net/manual/en/book.simplexml.php) that you can use in your templates.
You can access it in smarty via the {$xml} variable.
A good way to start is to do a {$xml|var_dump} to show the variables you can access to.
It will generate an "SimpleXML" Object (http://php.net/manual/en/book.simplexml.php) that you can use in your templates.
You can access it in smarty via the {$xml} variable.
A good way to start is to do a {$xml|var_dump} to show the variables you can access to.
Re: Xml query
Sorry i'm not following. i managed to do CD catalog tutorial (http://www.w3schools.com/XML/xml_examples.asp) but if i try to use same logic with my own XML (www.edeamedia.com/testi/testi.xml-> does not work at all.
Compare:
CD Catalog example:
{foreach from=$xml->CD item=CD}
{$CD->ARTIST}
{/foreach}
And my XML:
{foreach from=$xml->item id="439070" itemType="kivihomepagetransfer" item=property name="country_id"}
{$property name="country_id"->value}
{/foreach}
Compare:
CD Catalog example:
{foreach from=$xml->CD item=CD}
{$CD->ARTIST}
{/foreach}
And my XML:
{foreach from=$xml->item id="439070" itemType="kivihomepagetransfer" item=property name="country_id"}
{$property name="country_id"->value}
{/foreach}
Re: Xml query
Play with the following code:
Code: Select all
{foreach from=$xml->item item=element}
{foreach from=$element->property item=prop}
<pre>
{foreach from=$prop->attributes() item=attribute key=name}
attribute: {$attribute}
key: {$name}
{/foreach}
value: {$prop->value}
</pre>
{/foreach}
{/foreach}
Re: Xml query
Ok, now i can get whole package. If i want to pick just two values
Kivinen
and
matti.liljaniemi@jatkoaika.com
how should i proceed?
foreach loop for every value?
Kivinen
and
matti.liljaniemi@jatkoaika.com
how should i proceed?
foreach loop for every value?
