protected function compile()
{
/** @var PageModel $objPage */
global $objPage;
if (!strlen($this->inColumn)) {
$this->inColumn = 'main';
}
$intCount = 0;
$articles = array();
$id = $objPage->id;
$this->Template->request = \Environment::get('request');
// Show the articles of a different page
if ($this->defineRoot && $this->rootPage > 0) {
if (($objTarget = $this->objModel->getRelated('rootPage')) instanceof PageModel) {
$id = $objTarget->id;
/** @var PageModel $objTarget */
$this->Template->request = $objTarget->getFrontendUrl();
}
}
// Get published articles
$objArticles = \ArticleModel::findPublishedByPidAndColumn($id, $this->inColumn);
if ($objArticles === null) {
return;
}
while ($objArticles->next()) {
// Skip first article
if (++$intCount <= intval($this->skipFirst)) {
continue;
}
$cssID = \StringUtil::deserialize($objArticles->cssID, true);
$articles[] = array('link' => $objArticles->title, 'title' => \StringUtil::specialchars($objArticles->title), 'id' => $cssID[0] ?: 'article-' . $objArticles->id, 'articleId' => $objArticles->id);
}
$this->Template->articles = $articles;
}