|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
PHP Templating engine by Timothy Boronczyk
Hi Timothy
first off, great little tut, I like it and reckon it will be very usefull. I have been looking for an effective way to separate my code from my content for ages now, and there seems to be no one set way of doing that! I have a scenarion that I wonder if you could help me with. I essentially have a page (results.tpl) that is a table, with two columns and two rows. The first row is headings (id, name) and the second row is a tag/macro to be replaced with the results of a database call (returning id, name funnily enuff!) <table> <tr> <td>id</td> <td>name</td> </tr> <td> {rs} </table> Now, obviously the {rs} - recordset is a loop that runs through a series of mysql_fetch_assoc calls to get the data ... that data itself should be "templatable" i.e., I want a template for the results page that I can initiate from your template engine. Can you point me the right direction on this? I know you said that the engine supports nesting templates, how is this done, because I imagine nesting is the solution to what I am trying to do here ... Any help would be appreciated ! Tnx in advance. |
|
#2
|
||||||||
|
||||||||
|
RE: PHP Templating engine by Timothy Boronczyk
This is how I've done it...
results.php php Code:
results.tpl Code:
<table>
<tr><td>id</td><td>name</td></tr>
{RS}
</table>
table-rows.php php Code:
Best of luck, -Tim |
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > PHP Templating engine by Timothy Boronczyk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|