Note that there are some explanatory texts on larger screens.

plurals
  1. POefficient parsing xml with php
    primarykey
    data
    text
    <p>Is this the most efficient way to retrieve these xml elements using php? It is not too long but the three nested loops seems a bit weighty and just doesn't feel right.</p> <p>Thank you very much, Todd</p> <pre><code>// get the existing xml file $url = '../../page_xml/index.xml'; $xml = simplexml_load_file($url); // == Root tag // get the sliderImages node foreach($xml-&gt;Page as $page){ foreach($page-&gt;sliderImages as $sliderImages){ foreach($sliderImages-&gt;sliderImage as $sliderImage){ echo "&lt;strong&gt;Title:&lt;/strong&gt; ".$sliderImage."&lt;br/&gt;"; } } } </code></pre> <p>EDIT:</p> <p>Here is the xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;Root type="content"&gt; &lt;Page&gt; &lt;hMenuHighlight&gt;home&lt;/hMenuHighlight&gt; &lt;pageName&gt;Home&lt;/pageName&gt; &lt;sliderImages&gt; &lt;sliderImage&gt;images/home_slider/paper_bag.jpg&lt;/sliderImage&gt; &lt;sliderImage&gt;images/home_slider/red_box.jpg&lt;/sliderImage&gt; &lt;sliderImage&gt;images/home_slider/cubes.jpg&lt;/sliderImage&gt; &lt;sliderImage&gt;images/home_slider/gift_boxes.jpg&lt;/sliderImage&gt; &lt;/sliderImages&gt; &lt;pageText&gt; &lt;![CDATA[ &lt;h1&gt;Welcome to myShopName&lt;/h1&gt; &lt;!-- Start SLIDER IMAGES --&gt; &lt;div id="slideshow"&gt; &lt;!--##mySlideshowImages--&gt; &lt;/div&gt; &lt;!-- End SLIDER IMAGES --&gt; &lt;p&gt;Puzzle Logo image provided by &lt;a href="http://www.logoease.com"&gt;Logoease&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Paper bag image provided by &lt;a href="http://www.freedigitalphotos.net/images/view_photog.php?photogid=1012"&gt;Felixco, Inc. / FreeDigitalPhotos.net&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Red Box image provided by &lt;a href="http://www.freedigitalphotos.net/images/view_photog.php?photogid=1058"&gt;Arvind Balaraman / FreeDigitalPhotos.net&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Cubes image provided by &lt;a href="http://www.freedigitalphotos.net/images/view_photog.php?photogid=1152"&gt;jscreationzs / FreeDigitalPhotos.net&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Gift boxes image provided by &lt;a href="http://www.freedigitalphotos.net/images/view_photog.php?photogid=1152"&gt;jscreationzs / FreeDigitalPhotos.net&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Lorem ipsum dolor.&lt;/p&gt; ]]&gt; &lt;/pageText&gt; &lt;/Page&gt; &lt;/Root&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload