Re: [phplib] template question - please help! From: Oliver Manns (manns.o <email protected>)
Date: 11/29/00

Hi,

On 28 Nov 2000, at 11:56, vimcat wrote:

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

In the lib documentation is an example, which cover the same
topic. A variable contains only a string and a template contains
HTML - structures plus variables.

Your content.ihtml should look like this:

<-- BEGIN SQL_query -->
<table>
<-- BEGIN aRow -->
<TR>
<TD> the fields of the sql query </TD>
</TR>
<-- END aRow -->
<-- END SQL_query -->
</TABLE>

To handle the multiple rows you need the set_block - function.
Look at the example in template - documentation.

bye
Oliver

>
> ***************
> 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>
>

---------------------------------------------
Oliver Manns Johannisstr. 122 49074 Osnabrück
Tel. 202 64 04 Fax. 202 39 482
Mobil: 0177 8779499
Mail: Manns <email protected>, Manns.O <email protected>

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