Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://php.net/manual/en/domdocument.savexml.php" rel="nofollow"><code>DomDocument::saveXML()</code></a> doesnt take a file path - it returns the XML document as text. If you want to save it directly as a file like youre doing you use <a href="http://www.php.net/manual/en/domdocument.save.php" rel="nofollow"><code>DomDocument::save()</code></a>.</p> <p>All that logic in your phtml should be in your controller. You have also set the context to xml, so the view is going to output XML to the browser, not HTML... so id doesnt make sense to display a confirmation message unless its encoded in XML, otherwise you need to use the default context (HTML). So if you want to save the file to the webserver and display a confirmation you would do:</p> <pre><code>public function exportXmlAction(){ // remove the context switch from init // do your doctrine stuff // build the xml DOM as $xml $xml-&gt;save('path/to/file'); $this-&gt;message = 'File was exported successfully!'; } // in your phtml &lt;?php echo $this-&gt;message; ?&gt; </code></pre> <p>If you want to display the xml on screen:</p> <pre><code>public function exportXmlAction(){ // do your doctrine stuff // build the xml DOM as $xml $this-&gt;xmlDom = $xml; } // in your phtml &lt;?php echo $this-&gt;xmlDom-&gt;saveXml(); ?&gt; </code></pre> <p>The question i have though is whay would a user want ot export xml to the server. When you call <code>DomDocument::save()</code> youre saving that file to a path on the server, not the user's machine so what would be the point of exporting the xml to the server where the user has no access to it?</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. 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