i have to use a single line of PHP in my XML playlist to get the id for the link, which opens when the display is clicked.
here is an example

<track>
<title>something</title>
<creator>something</creator>
<location>something.flv</location>
<info>http://mysite.com/track/<?=($GET['nats']?$GET['nats']:'MDowOjM')?>/</info>
</track>

how i can make it to work in XML?

    tell the server to pass the particular file or all xml files through php- something like:

    AddHandler application/x-httpd-php5 .php .xml

      Note that this will only work if a) your host is running Apache, and b) the host used 'x-httpd-php5' as the type.

      Also, note that by sending XML files through the PHP parser, you run the risk of XML code being inadvertently handled as PHP code, especially if short_tags is enabled. You should therefore take measures to ensure that the short_tags directive is Off (e.g. in the .htaccess file using php_flag, again only if PHP was installed as an ISAPI module).

      Obviously, this means you can't use the short_tag syntax of "<?=" to print out variables. Note, however, that the short_tags directive has been deprecated for some time now and you should remove it from your scripts (and coding habits) regardless of whether you're working with XML or not.

        Alternatively, just give the file a .php suffix, and send a content-type header to serve it up as XML:

        playlist.php:

        <?php
        header('Content-Type: text/xml');
        // echo xml tag just in case short_open_tags is enabled in PHP config
        echo '<?xml version="1.0" encoding="UTF-8"?>';
        ?>
        <track>
        <title>something</title>
        <creator>something</creator>
        <location>something.flv</location>
        <info>http://mysite.com/track/<?php
        // always avoid using short php tags, they'll be totally gone in PHP6
        // also always filter external data such as $_GET
        echo (isset($_GET['nats'])) ? htmlspecialchars($_GET['nats']) : 'MDowOjM');
        ?>/</info>
        </track>
        

          And of course NogDog jumps in with a simple solution. :p

            bradgrafelman wrote:

            And of course NogDog jumps in with a simple solution. :p

            That's because I'm inherently lazy. Laziness is both a good and bad thing in a programmer: good in that it encourages us to find the simple, elegant, easy-to-maintain solution; bad in that it results in us spending to many late night coding sessions trying to meet deadlines that we've let slip while looking for that simple, elegant, easy-to-maintain solution. 😉

              I object! mine was more lazy it was only one line! :-)

                Write a Reply...