Jump to content

maybe permissions problem


Raullara

Recommended Posts

Hi again and thanks in advance.

 

I'm trying to write an xml file with information of my shop's products from my custom module. I was trying a simple code to write an xml, but is not working. After that i tried to do it on the index.php in my local folder and it works.

 

maybe my local prestashop has no permissions to write?

 

i did the chmod 777 to the whole folder

 

here's the code....

 

$xml = new DOMDocument("1.0");

 

$root = $xml->createElement("data");

$xml->appendChild($root);

 

$id = $xml->createElement("id");

$idText = $xml->createTextNode('1');

$id->appendChild($idText);

 

$title = $xml->createElement("title");

$titleText = $xml->createTextNode('"PHP Undercover"');

$title->appendChild($titleText);

 

 

$book = $xml->createElement("book");

$book->appendChild($id);

$book->appendChild($title);

 

$root->appendChild($book);

 

$xml->formatOutput = true;

 

 

$xml->save("mybooks.xml") or die("Error");

Edited by Raullara (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...