Hello All,

I am having one email template code as shown below.

<table width="400" border="0">
  <tr>
    <td><strong>Id</strong></td>
    <td><strong>Name</strong></td>
    <td><strong>Address</strong></td>
  </tr>
  <tr>
    <td>##ID##</td>
    <td>##NAME##</td>
    <td>##ADDRESS##</td>
  </tr>
</table>

Site administrator manage this.
Now i want php code to dynamic replace ##key## code.
It is simple for one record but here it is in table format. So m not able to clear it.
Once php code runs it check in database and outputs like as below:

<table width="400" border="0">
  <tr>
    <td><strong>Id</strong></td>
    <td><strong>Name</strong></td>
    <td><strong>Address</strong></td>
  </tr>
  <tr>
    <td>1</td>
    <td>Ria</td>
    <td>abc</td>
  </tr>
  <tr>
    <td>2</td>
    <td>Tom</td>
    <td>mno</td>
  </tr>
  <tr>
    <td>3</td>
    <td>John</td>
    <td>pqr</td>
  </tr>
</table>
Member Avatar for diafol

You need the

<tr>
<td></td>
<td></td>
<td></td>
</tr>

to be dynamic - include it in your while or for loop.

If you're using templates, you may be better off using a templating engine like Smarty or RainTPL.

Yes ardav,i have to use template.
And it is editable in admin side ckeditor.
My coding is in core php not any framework.
Do you have any logic?

Member Avatar for diafol

Um, this is tricky - for me anyway. If you only had the repeating elements (as I noted in a previous post) it would be simple - get the file contents into an array and to a simple str_replace in your while loop. I'll have a little think and a play. Maybe I'll get back to you.

Anybody else?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.