0

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>
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
0

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.

0

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?

0

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?

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.