SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP variables in XML

    Hi guys, can you tell me how to store php variables in XML? for example
    Code:
    <something><? $name = "User"; ?></something>
    I've tried pretty much everything, but when you pull data out of XML, it shows as
    Code:
    <? $name = "User"; ?>
    in other words it's not storing User in $name ...

  2. #2
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you making sure that PHP is parsing the document?

  3. #3
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be. Because when I insert other php tags outside the XML file they work just fine, so I have no idea what's wrong... Also, what's the best way to pull data out of an XML file -- PHP or perhaps JavaScript? I'm not really into XSL...

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I really know nothing about xml, however what is the page called that you are trying to use.

    Also, try:

    <?php echo $name; ?> and see if that prints anything.

  5. #5
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It prints nothing, in other words it's not parsing within XML...

  6. #6
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't remember, but you can create a .htaccess file and insert something to parse xml documents...something like

    addhandler/http-php .xml

    I really can't remember but if you search these forums you'll find the answer or how to get php to parse php3 documents.

    Just change .php3 to .xml

  7. #7
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't quite get what you are trying to do here, why would you want to try and store PHP variables in an XML file?

    If you could explain why you are trying to do it then it might help.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •