本文整理汇总了PHP中Portlet::onLoad方法的典型用法代码示例。如果您正苦于以下问题:PHP Portlet::onLoad方法的具体用法?PHP Portlet::onLoad怎么用?PHP Portlet::onLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portlet
的用法示例。
在下文中一共展示了Portlet::onLoad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onLoad
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();
}
示例2: onLoad
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();
}