[phplib] template question - please help! From: vimcat (vimcat <email protected>)
Date: 11/28/00

hi everyone. i'm new to using the template class. sorry if it seems like a
silly question. i've looked at several sites hoping to find a more detailed
tutorial. i learn best by examples and the lib documentation isn't helping
me much.

what i'm trying to do is to have {content} replaced by a mysql query. here's
what i've got in my page:

**********
<?php
  include("template.inc");

  $t = new Template("/my/dir/templates", "keep");

  $t->set_file(array(
 "page" => "page.ihtml",
 "footer" => "footer.ihtml",
 "content" => "content.ihtml"));

  $t->set_var(array(
 "title" => "boo",
 "pagetitle" => "my title"));

  $t->parse("output", array("footer", "page", "content"));

  $t->p("output");
?>
***************
contents of ihtml:

<!-- BEGIN content -->
<?php
include ("connection.inc");
$sql ="select * from vimcat_com_content";
$sql_result = mysql_query($sql, $connection);

echo "<table border=\"1\">";
echo "
<tr>
<th>Article ID</th>
<th>Title</th>
<th>Dept</th>
<th>Date Modified</th>
<th>Intro Text</th>
<th>Body Text</th>
<th>Section</th>";

while ($row = mysql_fetch_array($sql_result)) {
$article_id = $row["aid"];
$article_title = $row["title"];
$article_dept = $row["dept"];
$article_date = $row["time"];
$article_intro = $row["introtext"];
$article_body = $row["bodytext"];
$article_section = $row["section"];

echo "
<tr>
<td>$article_id</td>
<td>$article_title</td>
<td>$article_dept</td>
<td>$article_date</td>
<td>$article_intro</td>
<td>$article_body</td>
<td>$article_section</td>
</tr>";
}
echo "</table>"
?>
<!-- END content -->

***************
which ends out outputting:
http://www.vimcat.com/content_editor.php

in ie u can see the code,
in netscape just a blank page.

ps. i would use the table class and sql function of the lib.. but i don't
understand how to yet. thanks for your help!!

-veronica :)

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>