File: D:/HostingSpaces/NVonken/mijneigenlied.com/wwwroot/Core/Page Elements/news.element.php
<?php
class Element_News
{
public $elementName = 'News';
var $_tpl;
function __construct()
{
General::Load("NewsItem");
$this->_tpl = new tpl();
}
public static function Settings()
{
return array("Pageable" => false,
"DisplayName" => "Nieuwsitems",
"Version" => 1.0,
"Filename" => "news.element.php");
}
public function Run()
{
$news = NewsItem::SelectAll(2);
$newsList = "";
foreach ($news as $newsItem) {
$this->_tpl->assign("newsTitle", htmlspecialchars($newsItem->Title));
$this->_tpl->assign("newsTitleUrlSafe", General::UrlSafe($newsItem->Title));
$this->_tpl->assign("newsMessage", htmlspecialchars($newsItem->Content));
$this->_tpl->assign("newsId", $newsItem->Id);
$newsList .= $this->_tpl->parse("News/overview-item");
}
$this->_tpl->assign("newsItems", $newsList);
return $this->_tpl->Parse("News/overview");
}
}
?>