#1
  1. No Profile Picture
    Another damn newb...
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Bod, Norway
    Posts
    94
    Rep Power
    13

    Unhappy XML expertise needed!


    I have a webpage - simple one really.
    Its supposed to take in one variable in php and print this out using xml and svg.

    Here is the complete code:
    PHP Code:
    <?
      header
    ("Content-type: image/svg+xml");
      print(
    '<?xml version="1.0" encoding="iso-8859-1"?>');
    ?>

    <?php $text="This page uses PHP and SVG"?>

    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
    "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">

    <svg xml:space="preserve" width="100%" height="20">
        <desc>Using styles</desc>
        <rect style="fill:#333333" x="0" y="0" width="100%" height="145"/>
        <text x="50" y="70" style="text-anchor:left; fill:#cccccc; font-size:26;
        font-weight:15; font-family:Tahoma, Verdana; font-style:regular"><?php echo
        
    $text?></text>
    </svg>
    You can see it in action here:
    follow this link
    (if the code snipplet above doesn't show correctly, just view source at the URL)

    Now... The php code isn't even parsed, and its returning a strange error message which I do not understand... ANYONE have ANY idea as to why this is happening?

    The person that wrote the code says it works fine on his server, so I'm wondering what's the matter here... Are the server settings screwed up or??

    HELP!!!
    Torkil Johnsen

    Never underestimate the power of stupid people in large groups...
    ---------------------------(,)----
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    10
    Rep Power
    0
    Your files has a .psvg extension. PHP will only parse pages with .php or .php3 (and sometimes .php4) extensions. It's not parsing your PHP code and it's interpreting your PHP code as an XML file. Change your file name to index.php and I bet it will work. Also when you are mixing PHP and XML, you should always start a PHP block with a "<?php" instead of just a "<?" It goofs up occasionally if you do not do this.
  4. #3
  5. No Profile Picture
    Another damn newb...
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Bod, Norway
    Posts
    94
    Rep Power
    13

    Wow...


    As easy as that, huh?

    Well it worked just fine here in my end, so I hope you on your side can settle for a 'thank you'

    ... *amazed*

    On a sidenote: If .psvg is interpreted as .php, like .php3, .php, and .inc, should the index.psvg-file not have worked just fine then, or??

    Thanks again...
    Torkil Johnsen

    Never underestimate the power of stupid people in large groups...
    ---------------------------(,)----
  6. #4
  7. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    14
    Of course you could also use the .psvg extension, but the server has to be configured for this. This is not the case on most servers, but if you have your own one you could easily configure this.
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs

IMN logo majestic logo threadwatch logo seochat tools logo