本文整理匯總了PHP中Banner::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Banner::getAll方法的具體用法?PHP Banner::getAll怎麽用?PHP Banner::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Banner
的用法示例。
在下文中一共展示了Banner::getAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: jkbanners_display_banners
function jkbanners_display_banners($atts)
{
$a = shortcode_atts(array('id' => false, 'filter_menu_order' => false, 'template' => 'list'), $atts);
$output = array();
//
$banners = array();
$banners = Banner::getAll();
if ($a['filter_menu_order']) {
foreach ($banners as $bk => $banner) {
if ($banner->post->menu_order != $a['filter_menu_order']) {
unset($banners[$bk]);
}
}
}
//
$bannerTemplate = new Template();
//One random banner
if ($a['template'] == 'random-single') {
//get a random item
$banner = $banners[array_rand($banners)];
//show single banner
$bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/single.php', array('banner' => $banner));
$output[] = $bannerTemplateResponse;
}
//List all banners
if ($a['template'] == 'list') {
$bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/list.php', array('banners' => $banners));
$output[] = $bannerTemplateResponse;
}
//
$output = implode("\n", $output);
return $output;
}
示例2: indexAction
public function indexAction()
{
$this->view->Title = "Quản lý quảng cáo";
$this->view->headTitle($this->view->Title);
$page = $this->getRequest()->getParam('page');
$condition = array();
list($this->view->Pager, $this->view->Banner) = Banner::getAll($condition, $page);
}