Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Start with something like this:</p> <pre><code>$doc = simplexml_load_file("feedpage.xml"); </code></pre> <p>Then (since I don't know what your XML file looks like), try:</p> <pre><code>echo "&lt;pre&gt;".print_r($doc,true)."&lt;/pre&gt;"; </code></pre> <p>to see exactly how the resulting object is laid out. From there, you should be able to pick out the pieces you need to build what you want.</p> <p><em><strong>Edit:</em></strong></p> <p>If your output is:</p> <pre><code>SimpleXMLElement Object ( [varOne] =&gt; SimpleXMLElement Object ( [varOne] =&gt; Title [varTwo] =&gt; A description [VarThree] =&gt; A Link [VarFour] =&gt; An Image ) ) </code></pre> <p>You could do this to access the properties of each one:</p> <pre><code>foreach($doc as $row) { $title = $row-&gt;varOne; $description = $row-&gt;varTwo; // etc. } </code></pre> <p>So with the <code>foreach</code> loop, you can go through each main item and access each item's properties.</p> <p>And if you want to put code in comments, you can use the backtick (`) to surround your text, but it doesn't work well for code blocks (like the one you wanted to post). Best for variables or other short bits.</p> <p><em><strong>FINAL EDIT:</em></strong></p> <p>Let's take this example object:</p> <pre><code>SimpleXMLElement Object ( [varOne] =&gt; SimpleXMLElement Object ( [varOne] =&gt; "Title" [varTwo] =&gt; "Description" [varThree] =&gt; "Link" [varFour] =&gt; "Image" [varFive] =&gt; SimpleXMLElement Object ( [varA] =&gt; "something" [varB] =&gt; SimpleXMLElement Object ( [varX] =&gt; "a string" ) [varC] =&gt; "another thing" ) ) ) </code></pre> <p>Let's say the whole thing is contained in a variable <code>$obj</code>. Now let's say we wanted what's in <code>varX</code>. We'd access it like this:</p> <pre><code>echo $obj-&gt;varOne-&gt;varFive-&gt;varB-&gt;varX; </code></pre> <p>Beyond this, I don't know what else to tell you. You need to closely examine the objects you have and determine how they are structured. Extrapolate what you've learned here and apply it to your situation.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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