FMR
-
Posts
7 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by FMR
-
-
You should not need the .xml extension. What happens when you open the file in your browser?
When I change the extension I also change all references to
productsXMLFile : "data-provider/products.xml",
for
productsPHPFile : "data-provider/products.php",
and
url: configOptions.productsXMLFile+"?file="+DateTime.getTime(),
dataType: "xml",
for
url: configOptions.productsPHPFile+"?file="+DateTime.getTime(),
dataType: "php",
inside of the .js
But I get an error message saying: Can't load products.
That's why I suspected I couldn't change the extension. There is something I'm missing.
-
The file is saved as UTF-8 with a Byte-Order Mark. There are actually three invisible characters being sent before the header. You should open the file in a text editor and change the encoding to be UTF-8 without BOM.
I remove the BOM and the error is gone. But it still doesn't work. I guess I must keep the .xml extension. But the server just doesn't recognize the php inside it. Any idea on how to force it?
Thank you for the help!
-
You could just leave the extension as .php. As long as the content-type header is set to text/xml it should still be interpretted as XML by the browser.
If you really need the extension to be .xml, the AddType directive should probably work, what happened when you tried it?
In fact, I don't know if this is related but when I try to load the file 1 on itself I get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/steph941/public_html/miseau-point/code/etudiantfr/data-provider/products.php:1) in /home/steph941/public_html/miseau-point/code/etudiantfr/data-provider/products.php on line 2
I checked for white spaces and there is none.
-
You could just leave the extension as .php. As long as the content-type header is set to text/xml it should still be interpretted as XML by the browser.
If you really need the extension to be .xml, the AddType directive should probably work, what happened when you tried it?
The file just won't load. I tried to change the extension but it didn't work either.
-
Hello everyone,
I'm trying to include this PHP code inside of a .xml:
<?php
$parent = basename(dirname($_SERVER['PHP_SELF']));
echo $parent;
?>The code doesn't seem to be recognized at all.
I tried to create a .htaccess file and dropped it in the same folder as the .xml:
AddHandler x-httpd-php .xml
AddHandler php-script .php .xml
AddHandler php5-script .php .xml
AddType application/x-httpd-php .xml
AddType application/x-httpd-php .xmlI was trying the parse .xml as .php. I changed the header of the xml for:
<?php
header("Content-Type: text/xml;charset=utf-8");
?>and still no luck.
I attached the xml file with this post.
I must say. I'm out of ideas for something I am sure is possible.
If someone has any ideas at all it would be really appreciated.
Thank you in advance!
FMR
-
Hello everyone,
I'm trying to include this PHP code inside of a .xml:
<?php
$parent = basename(dirname($_SERVER['PHP_SELF']));
echo $parent;
?>The code doesn't seem to be recognized at all.
I tried to create a .htaccess file and dropped it in the same folder as the .xml:
AddHandler x-httpd-php .xml
AddHandler php-script .php .xml
AddHandler php5-script .php .xml
AddType application/x-httpd-php .xml
AddType application/x-httpd-php .xmlI was trying the parse .xml as .php. I changed the header of the xml for:
<?php
header("Content-Type: text/xml;charset=utf-8");
?>and still no luck.
I attached the xml file with this post.
I must say. I'm out of ideas for something I am sure is possible.
If someone has any ideas at all it would be really appreciated.
Thank you in advance!
FMR
Include PHP code inside XML
in PHP
Posted
When I open the file in php without BOM with direct path it works but when I try to open the page which needs the products.xml (or .php) I get the "can't load products" error.