By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,407 Members | 1,583 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,407 IT Pros & Developers. It's quick & easy.

More help with templates please

P: n/a
I am still struggling to get my mind around having html templates doing the
mark-up. What do I have to change so the PHP script that will bring in the
HTML template and put the value $row in the table?

Cheers

Phil
<?php
// simple PHP script that outputs just one string
require_once "DB.php";
$dsn = "pgsql://username:password@localhost/zendtestdatabase";
$db = DB::connect($dsn);
$query = "SELECT * FROM links WHERE link_id = 3";
$result = $db->query($query);
while ($row = $result->fetchRow())
{
print "$row[1] <br />";
}
$result->free();
$db->disconnect();
?>

<html>
<!-- basic html template -->
<body>
<table border="1" cellpadding="1" cellspacing="1" width="95%" >
<tr>
<th>Title</th>
</tr>
<tr>
<td><?=$row?></td>
</tr>
</table>
</body>
</html>
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Phil Latio" <ph********@f-in-stupid.co.uk> wrote in message
news:9M*********************@fe06.news.easynews.co m...
I am still struggling to get my mind around having html templates doing the mark-up. What do I have to change so the PHP script that will bring in the
HTML template and put the value $row in the table?


hmm.. you did not tell which template mechanics (if any) you are trying to
use. There are several template engines present, and even php can be used as
one, and the answer will depend on which one you are using,

For examples how to do it with TemplateTamer see:

http://www.templatetamer.org/index.p...emplateExample

and only a tiny bit more advanced one:

http://www.templatetamer.org/index.p...leMySqlRowList

rush
--
http://www.templatetamer.com/
http://www.folderscavenger.com/
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.