Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml php versioning

Status
Not open for further replies.

venedos

Technical User
Oct 25, 2006
8
CZ
Hi you guys,
I've encountered a problem with implementing .xml file (/content) into a .php document. I've incorporated it using the php print () function
Code:
 print('<'.'?');?>xml version="1.0" encoding="utf-8"........

to not make the php parser consider <?xml encoding=...... as the beginning of a php script. The prob now is that i dunno how to make the xml parser to evaluate the content of this file (with the file extension .php3). I would be really greatful if u helped me out. Thx in advance.
 
The easy solution is to turn off short_open_tag in your php.ini file. That will tell PHP to only use <?php to mark the beginning of a PHP block and to ignore the <? used for XML.

Just out of curiosity, why are you trying to run a PHP script through an XML parser? I can understand parsing the output of the script, but it's not immediately obvious why you'd want to do the script itself.
 
Thank zou verz much for zour reply.

Most probably I had described my prob in too perplexing way, which is why u got it wrong if the parsing itself is for question.

What i am trying to make is a php file, that would include the appropriate .xml file according to the value of the variable following ? . It should display the program of an internet radio acoording to the date selected by a client (the day variable in the example below)
E.g. an url

://abcd.xy/aaaa.php?day=[color]monday[/color]

Code:
<?php
function pinch($what)                 {
$fil = "$what.xml";
if(file_exists($fil)) {
include $fil;
                      }
else {
header ("Location: error.php3?prob=dcmt_nt_found");
     }
                             
                                        }

switch($day) {
case "monday":
pinch($day);
break;
etc..... 
            }
?>

Thanks to your helpful advice i've succeeded to get the .xml file content into the php file. What i would like to achieve now is the (de facto only) the xml content of the (.php) file to be dislplayed using the xml parser. If there is any way to do so, pls let me know.
Thx beforehand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top