View Single Post
Old 10-23-2007, 07:56 PM   #1 (permalink)
Sam Granger
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default Help! Trying to template something here. :)

Hey guys. I'm aving trouble templating a while statement. See the code below.

PHP Code:
<?php

/**
 * @author Sam Granger
 * @copyright 2007
 */

defined('parent') or die('Direct access to this file is not allowed!');

$interface = new Interface('array');
$interface->title "News";
$interface->keywords "News";

$database = new MySQL();

$connection $database->Connect($DB_SERVER$DB_USER$DB_PWD$DB_NAME);

$sql "SELECT id, title, DATE_FORMAT(published,'%d-%m-%Y') AS published FROM news";
$query $database->Query($sql);

while(
$array $database->FetchArray($query)){
    
extract($array);
    echo 
"<p>$id$title$published</p>";
}

$interface->content "while content should really go here!";
$interface->Display();

?>
Ok, I want $interface->content to equal all the rows outputted by the while statement.

How can I do this? Looking forward to suggestions. Template system basically replaces a tag in a file with the content that I want.
Sam Granger is offline  
Reply With Quote