Jump to content

How do I include PHP codes in an XML file?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Nokia N93

Nokia N93

    Newbie

  • Members
  • Pip
  • 5 posts
How do I include PHP codes in an XML file?

I have a FLASH Gallery that i want to alter the names of the photo's
but i can't do that because i don't know how to include the PHP in the XML file ,, can you help me ?


#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
You can tell Apache to parse XML files for PHP code by creating a file named .htaccess (note it has a period at the beginning) within the same folder as your script, and adding the following contents:
AddType application/x-httpd-php .xml
You can then freely use <?php ?> tags within your xml file and it will be generated automatically each time.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
Nokia N93

Nokia N93

    Newbie

  • Members
  • Pip
  • 5 posts

Nullw0rm said:

You can tell Apache to parse XML files for PHP code by creating a file named .htaccess (note it has a period at the beginning) within the same folder as your script, and adding the following contents:
AddType application/x-httpd-php .xml
You can then freely use <?php ?> tags within your xml file and it will be generated automatically each time.

thanx Nullw0rm ,,, i'm not professional at PHP nor XML
but i searched for something called SimpleXML
is it possible to use it in this case,, if u have ever tried it ?

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
SimpleXML is a class to work with XML documents within PHP, I am not sure if that is what you're looking for.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.