RevCMS Template System Error

Kristopher

Photographer
Dec 25, 2010
803
68
I'm trying to stick with Rev's template system and edit how I want the news to be displayed in a list. So basically I'm trying to get the date to display where the header is code I'm using below in the quote

$template->setParams('newsList', '<a class="newsListElement"<a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '<br/>' . '<i>' $news1['published'] . '</i></a>');

Old Code:
final public function getPageNews()
{
global $template, $engine;

if(!isset($_GET['id']) || !is_numeric($_GET['id']))
{
$_GET['id'] = 1;
}
$result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");

while($news1 = mysql_fetch_array($result))
{
$template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
}

$news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
$template->setParams('newsTitle', $news['title']);
$template->setParams('newsContent', $news['longstory']);
$template->setParams('newsAuthor', $news['author']);
$template->setParams('newsDate', date("d-m-y", $news['published']));

unset($result);
unset($news1);
unset($news);
}

New Code:
final public function getPageNews()
{
global $template, $engine;

if(!isset($_GET['id']) || !is_numeric($_GET['id']))
{
$_GET['id'] = 1;
}
$result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");

while($news1 = mysql_fetch_array($result))
{
$template->setParams('newsList', '<a class="newsListElement"<a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '<br/>' . '<i>' $news1['published'] . '</i></a>');
}

$news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
$template->setParams('newsTitle', $news['title']);
$template->setParams('newsContent', $news['longstory']);
$template->setParams('newsAuthor', $news['author']);
$template->setParams('newsDate', date("d-m-y", $news['published']));

unset($result);
unset($news1);
unset($news);
}
 
Last edited:

Users who are viewing this thread

Top