1

I'm working on a mailer system where I'm required to replace variables in html template with actual values in our database. Earlier, I was getting a plain HTML template where I was required to overwrite the variable's actual value from database to the template itself. However, I was not comfortable with it. I made the following suggestion that instead of whole HTML template, pass XML containing the attributes which we seek to replace with actual values from database(sort of RSS). Now I am finding a way to put the actual values found from the database to the original template. Let us take an example:

<html>
  <body>
    <div var="toxml">
      <li>
        PROFILEID(This will be a number)
        NAME
        AGE(etc.)
      </li>
    </div>
  </body>
</html>

The XML which will be generated out of this will be

<PROFILEID val="Number">
  <NAME></NAME>
  <AGE></AGE>
</PROFILEID>

Now I will stuff in the values from database in this xml only(XML parsing tools are available for php).

Now my question is, how can I put the stuffed values in the XML back to the HTML template from which it came?

4

0 回答 0