0

Hello,

My question is a bit theoreric at the moment.
I have a XML file that contains some data, i would like to know if it is possible to write a PHP page that reads the XML file, and if he recognizes a spesific string in the XML file, he updates a HTML file with that string.

Is this possible do to using PHP ? i know that PHP can read a XML file, but can he update a spesific line within a HTML file as well.

Thanks in advance.

3
Contributors
4
Replies
21
Views
4 Years
Discussion Span
Last Post by diafol
0

I'm no pro at manipulating XML with PHP, but reading up on the DOM extension may be helpful. You should be able to grab the element you want from the XML, do any further processing you want to, then grab the element you want from the HTML and modify it as needed.

0

@EvolutionFallen, so in principle i can modify a HTML page by using PHP.

That's what I've hopped for.

0

Absolutely. You can even simply put PHP code right into a .html file, you just need to change your .htaccess to tell Apache it should process PHP found in .htmls.

0

You have many approaches open to you, depending on what exactly you need to do. For example, are the html files already created and not allowed to be edited?

You could use a "template" to produce a dynamic page. There are native php functions you could use to do this or you could use a lightweight templating engine such as RainTPL or Twig. If you could rename your .html pages to .php then you wouldn't have to mess with your .htaccess files.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.