Im trying to link a JS library into a php dynaimcally generated xml document. except it keeps returning an error in the header? and I am having a problem with the link due to the “”, which is normally used for a string in php. Any thoughts?
$id = '1232';
$name = 'Christopher';
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo "<xml>";
echo "<id>";
echo "<name>";
echo "</name>";
echo "</id>";
echo "</xml>";
I’m trying to add in a link to a js however I am unsure how to generate the code with php??
The link would look like
<script src="processing.js"></script>
Is there a way to do this?
I’m not exactly sure what your trying to do with jaavascript because I don’t think you can have javascript in an xml file but if you wanted to output the js with the xml here is what your could should look like
since you are outputing xml you don’t want break elements in your xml instead you want new line characters to make it readable by source.
I think what your really want for the js is to just give the link location in the xml but i’m not 100% on that I’m a little fuzzy on what your trying to do
ohh and you don’t need breaks in the header
** To answer your questions **
again I’m still not sure if your trying to execute javascript in xml or if you are simply trying to provided full link or relative line in the xml
so if you wanted to have a relative link adding
for a full link
and if you want to execute the js
I think you want to put this in the xml
however I believe that will only work in firefox
pleas see this blog for more detailson that