Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have already proven to create an XML document by your syntax - just recreate the standard template.</p> <p>For example's sake, I will pretend your website info is stored in array such as:</p> <pre><code>$yourSiteContent = array( array('permalink' =&gt; 'http://www.somesite.com/someurl1', 'updated' =&gt; '2012-08-11T04:08:53+01:00'), array('permalink' =&gt; 'http://www.somesite.com/someurl2', 'updated' =&gt; '2012-09-11T04:08:53+01:00'), array('permalink' =&gt; 'http://www.somesite.com/someurl3', 'updated' =&gt; '2012-10-11T04:08:53+01:00') ); </code></pre> <p>Then sticking back to your example:</p> <pre><code>$xml = new DomDocument('1.0', 'utf-8'); $xml-&gt;formatOutput = true; // creating base node $urlset = $xml-&gt;createElement('urlset'); $urlset -&gt; appendChild( new DomAttr('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9') ); // appending it to document $xml -&gt; appendChild($urlset); // building the xml document with your website content foreach($yourSiteContent as $entry) { //Creating single url node $url = $xml-&gt;createElement('url'); //Filling node with entry info $url -&gt; appendChild( $xml-&gt;createElement('loc', $entry['permalink']) ); $url -&gt; appendChild( $lastmod = $xml-&gt;createElement('lastmod', $entry['updated']) ); $url -&gt; appendChild( $changefreq = $xml-&gt;createElement('changefreq', 'monthly') ); $url -&gt; appendChild( $priority = $xml-&gt;createElement('priority', '0.5') ); // append url to urlset node $urlset -&gt; appendChild($url); } $xml-&gt;save("data.xml"); </code></pre> <p>The rest is up to you.</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