Dear DevNet Resident
The code into file
list_records.php do it but i want to merge this file with the html template engine
http://www.broculos.net/tutorials/how_t ... 0080315/en
I failed to do it , please download the template file
http://www.broculos.net/files/articles/ ... Engine.rar
I want to merge list_records.php with user_profile.php.
This is the code of user_profile.php
Code: Select all
?php
include("template.class.php");
/**
* Creates a new template for the user's profile.
* Fills it with mockup data just for testing.
*/
$profile = new Template("user_profile.tpl");
$profile->set("username", "monk3y");
$profile->set("photoURL", "images/photo.jpg");
$profile->set("name", "Monkey man");
$profile->set("age", "23");
$profile->set("location", "Portugal");
/**
* Loads our layout template, settings its title and content.
*/
$layout = new Template("layout.tpl");
$layout->set("title", "User profile");
$layout->set("content", $profile->output());
/**
* Outputs the page with the user's profile.
*/
echo $layout->output();
?>
And this is the code of list_records.php
Code: Select all
<?php
include "config.php";
$sql="SELECT * FROM news ";
$result=mysql_query($sql);
?>
<table width="400" border="0" align="right" cellpadding="0" cellspacing="1">
<tr>
<td>
<table width="400" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="4"><div align="right"><strong>???????</strong><strong></strong></div></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td rowspan="-1" align="center"><div align="right"><a href="update.php?id=<? echo $rows['id']; ?>"><? echo $rows['title']; ?></a></div></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<?php
mysql_close();
?>
I need to know how can i put the result of this part of code from list_records.php
Code: Select all
<tr>
<td rowspan="-1" align="center"><div align="right"><a href="update.php?id=<? echo $rows['id']; ?>"><? echo $rows['title']; ?></a></div></td>
</tr>
Into the this part from user_profile.php
Code: Select all
$profile = new Template("user_profile.tpl");
$profile->set("username", "[color=#FF0000]monk3y[/color]");
[b]Please change $content->set("content", "[color=#FF0000]the result code from list_records.php[/color]");[/b]
How can i do it ?
Thank you DevNet Resident