本文整理匯總了PHP中Component::renderComponent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Component::renderComponent方法的具體用法?PHP Component::renderComponent怎麽用?PHP Component::renderComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Component
的用法示例。
在下文中一共展示了Component::renderComponent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renderComponent
public function renderComponent()
{
$content = "";
if ($this->hasProperty('_sub')) {
foreach ($this->getPropertyValue('_sub') as $post) {
$title = isset($post['title']) ? $post['title'] : 'no title';
$user = isset($post['user']) ? $post['user'] : 'anonymous';
$msg = isset($post['msg']) ? $post['msg'] : 'no message';
$content .= "\n\t\t\t\t<div class='post'>\n\t\t\t\t\t<div class='title'>{$title}</div>\n\t\t\t\t\t<div class='user'>Posted by {$user}</div>\n\t\t\t\t\t<div class='text'>{$msg}</div>\n\t\t\t\t</div>";
}
}
$this->xtpl->assign('CONTENT', $content);
return parent::renderComponent();
}
示例2: renderComponent
public function renderComponent()
{
$content = "";
if ($this->hasDatasource()) {
$ds = $this->getDatasource();
foreach ($ds->content as $item) {
$label = isset($item['label']) ? $item['label'] : 'no label';
$target = isset($item['target']) ? $item['target'] : '';
$page = isset($item['page']) ? $item['page'] : '';
$this->xtpl->assign('LABEL', $label);
if ($page == 'true') {
$this->xtpl->assign('TARGET', '?page=' . $target);
} else {
$this->xtpl->assign('TARGET', $target);
}
$this->xtpl->parse('main.item');
}
}
$this->xtpl->assign('CONTENT', $content);
return parent::renderComponent();
}
示例3: renderComponent
public function renderComponent()
{
$text = $this->hasProperty('text') && $this->getPropertyValue('text') != '' ? $this->getPropertyValue('text') : 'no text';
$this->xtpl->assign('CONTENT', $text);
return parent::renderComponent();
}