Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thanks for all the suggestions. They all gave me more information than I had before about accessing nested nodes. I went with a modified version of Jamie's suggestion. With each community node I accessed the URLS with this loop.</p> <pre><code> foreach($node-&gt;URLS-&gt;URL as $url) { // Print HTML elements with the URL information } </code></pre> <p>Here is the working script in its entirety.</p> <pre><code>&lt;?php function get_nodes() { // load SimpleXML $nodes = new SimpleXMLElement('communities.xml', null, true); foreach($nodes as $node) // loop through { echo "&lt;div id = '".$node['ID']."' class= 'comdiv ui-widget-content' style = 'top: ".$node-&gt;TOP."px; left: ".$node-&gt;LEFT."px; width: ".$node-&gt;WIDTH."px; height: ".$node-&gt;HEIGHT."px;'&gt; \n"; echo " &lt;p class = 'comhdr editableText ui-widget-header'&gt;".$node-&gt;NAME."&lt;/p&gt;\n"; echo " &lt;a href='#' onClick=\"delete_div('".$node['ID']."');\"&gt;Delete&lt;/a&gt;&amp;nbsp;&amp;nbsp;\n"; echo " &lt;a href='#' onClick=\"add_url('".$node['ID']."');\"&gt;Add URL&lt;/a&gt;&amp;nbsp;&amp;nbsp;\n"; echo "&lt;/div&gt; \n"; echo "&lt;script type='text/javascript'&gt;\n"; echo " $('#".$node['ID']."').resizable();\n"; echo " $('#".$node['ID']."').draggable();\n"; echo " $('#".$node['ID']."').draggable('option', 'handle', '.comhdr');\n"; echo "&lt;/script&gt;\n"; foreach($node-&gt;URLS-&gt;URL as $url) { echo "&lt;script type='text/javascript'&gt; alert('Node: ".$node['ID']." has URLS:".$url['ID']." ".$url-&gt;NAME." ".$url-&gt;URL." '); &lt;/script&gt;"; } } echo "&lt;script type='text/javascript'&gt;\n"; echo " $('.editableText').editableText();\n"; echo "&lt;/script&gt;\n"; return; } echo get_nodes(); ?&gt; </code></pre>
 

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