Source for file home.php
Documentation is available at home.php
require_once 'createlu.php';
require_once 'HTML/Template/IT.php';
// Setup template objects
if (!$usr->isLoggedIn ()) {
$tpl = new HTML_Template_IT ('./');
$tpl->loadTemplatefile ('login_form.tpl', true , false );
$login = '<p>User: ' . $usr->getProperty ('handle') . ' !</p>';
$login .= '<p><a href="admin.php">Go to the admin part</a></p>';
$login .= '<p><a href="?logout=1">Logout</a></p>';
$tpl = &new HTML_Template_IT ('./');
$tpl->loadTemplatefile ('home.tpl', true , true );
// assign the content to the vars
$tpl->setVariable ('GENERALNEWS', getNews($db, 'general'));
$tpl->setVariable ('LOGIN', $login);
// This function is to fetch news from the MDB2
function getNews(&$db, $newsCategory)
DATE_FORMAT(news_date, '%D %b %Y at %H:%I:%S') AS date,
news_category = '$newsCategory'
$news = $db->queryAll ($query, null , MDB2_FETCHMODE_ASSOC , true );
if (PEAR ::isError ($news)) {
die ($news->getMessage () . ' ' . $news->getUserinfo ());
$tpl = new HTML_Template_IT ('./');
$tpl->loadTemplatefile ('news.tpl', true , true );
foreach ($news as $name) {
$tpl->setCurrentBlock ('row');
$tpl->setVariable ('DATE', $name['date']);
$tpl->setVariable ('TITLE', $name['title']);
$tpl->setVariable ('CONTENT', $name['content']);
$tpl->parseCurrentBlock ('row');
Documentation generated on Mon, 11 Mar 2019 15:40:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|