public function onLoad($param) { parent::onLoad($param); $cats = $this->Application->getModule('data')->queryCategories(); foreach ($cats as $cat) { $cat->ID = $this->Service->constructUrl('Posts.ListPost', array('cat' => $cat->ID)); $cat->Name .= ' (' . $cat->PostCount . ')'; } $this->CategoryList->DataSource = $cats; $this->CategoryList->dataBind(); }
public function onLoad($param) { parent::onLoad($param); $commentLimit = TPropertyValue::ensureInteger($this->Application->Parameters['RecentComments']); $comments = $this->Application->getModule('data')->queryComments('', 'ORDER BY create_time DESC', "LIMIT {$commentLimit}"); foreach ($comments as $comment) { $comment->ID = $this->Service->constructUrl('Posts.ViewPost', array('id' => $comment->PostID)) . '#c' . $comment->ID; if (strlen($comment->Content) > 40) { $comment->Content = substr($comment->Content, 0, 40) . ' ...'; } } $this->CommentList->DataSource = $comments; $this->CommentList->dataBind(); }