本文整理汇总了PHP中api::maxPages方法的典型用法代码示例。如果您正苦于以下问题:PHP api::maxPages方法的具体用法?PHP api::maxPages怎么用?PHP api::maxPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api
的用法示例。
在下文中一共展示了api::maxPages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($id = '/')
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$templates = $blueprint->pages()->template();
$options = array();
$back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
$form = app::form('pages.add');
$form->save = l('add');
$form->back = a::get($back, get('to'));
foreach ($templates as $template) {
$options[$template->name()] = $template->title();
}
$select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
if ($templates->count() == 1) {
$select->readonly = true;
$select->value = $templates->first()->name();
}
$form->fields()->append('template', $select);
if (api::maxPages($page, $blueprint->pages()->max())) {
$form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
$form->save = false;
$form->centered = true;
}
return view('pages/add', array('page' => $page, 'form' => $form));
}
示例2: content
/**
* Generate field content markup
*
* @return string
*/
public function content()
{
$wrapper = new Brick('div');
$wrapper->addClass('subpagelist');
$children = $this->subpages();
// add pagination to the subpages
$limit = $this->limit() ? $this->limit() : 10000;
$children = $children->paginate($limit, array('page' => get('page')));
// use existing snippet to build the list
// @see panel/app/controllers/views/pages.php
$subpages = new Snippet('pages/sidebar/subpages', array('title' => l('pages.show.subpages.title'), 'page' => $this->page(), 'subpages' => $children, 'addbutton' => !api::maxPages($this, $this->subpages()->max()), 'pagination' => $children->pagination()));
// use template with defined vars
$wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('subpages' => $subpages)));
return $wrapper;
}
示例3: index
public function index()
{
$site = site();
$widgets = array();
$wroot = kirby()->roots()->widgets();
$wdirs = dir::read($wroot);
// fetch all top-level pages in the right order
$blueprint = blueprint::find($site);
$pages = api::subpages($site->children(), $blueprint);
foreach ($wdirs as $dir) {
$file = $wroot . DS . $dir . DS . $dir . '.php';
if (file_exists($file)) {
$widgets[$dir] = (require $file);
}
}
return view('dashboard/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb'), 'search' => purl('pages/search/'))), 'history' => history::get(), 'site' => $site, 'pages' => $pages, 'addbutton' => !api::maxPages($site, $blueprint->pages()->max()), 'widgets' => $widgets, 'user' => site()->user(), 'license' => panel()->license()));
}
示例4: index
public function index($id = null)
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$visible = api::subpages($page->children()->visible(), $blueprint);
$invisible = api::subpages($page->children()->invisible(), $blueprint);
$baseUrl = rtrim(purl('subpages/index/' . $page->id()), '/');
// don't create the view if the page is not allowed to have subpages
if ($blueprint->pages()->max() === 0) {
goToErrorView();
}
if ($limit = $blueprint->pages()->limit()) {
$visible = $visible->paginate($limit, array('page' => get('visible')));
$invisible = $invisible->paginate($limit, array('page' => get('invisible')));
$visiblePagination = new Snippet('subpages/pagination', array('pagination' => $visible->pagination(), 'nextUrl' => $baseUrl . '/visible:' . $visible->pagination()->nextPage() . '/invisible:' . $invisible->pagination()->page(), 'prevUrl' => $baseUrl . '/visible:' . $visible->pagination()->prevPage() . '/invisible:' . $invisible->pagination()->page()));
$invisiblePagination = new Snippet('subpages/pagination', array('pagination' => $invisible->pagination(), 'nextUrl' => $baseUrl . '/visible:' . $visible->pagination()->page() . '/invisible:' . $invisible->pagination()->nextPage(), 'prevUrl' => $baseUrl . '/visible:' . $visible->pagination()->page() . '/invisible:' . $invisible->pagination()->prevPage()));
}
return view('subpages/index', array('page' => $page, 'topbar' => new Snippet('pages/topbar', array('menu' => new Snippet('menu'), 'breadcrumb' => new Snippet('pages/breadcrumb', array('page' => $page, 'items' => array(array('url' => purl('subpages/index/' . $id), 'title' => l('subpages'))))), 'search' => purl($page, 'search'))), 'baseurl' => $baseUrl, 'addbutton' => !api::maxPages($page, $blueprint->pages()->max()) and $page->hasChildren(), 'sortable' => $blueprint->pages()->sortable(), 'visible' => $visible, 'flip' => $blueprint->pages()->sort() == 'flip', 'visiblePagination' => $visiblePagination, 'invisible' => $invisible, 'invisiblePagination' => $invisiblePagination));
}
示例5: site
<?php
$site = site();
$blueprint = blueprint::find($site);
$pages = api::subpages($site->children(), $blueprint);
$addbutton = !api::maxPages($site, $blueprint->pages()->max());
$options = array(array('text' => l('dashboard.index.pages.edit'), 'icon' => 'pencil', 'link' => '#/subpages/index/'));
if ($addbutton) {
$options[] = array('text' => l('dashboard.index.pages.add'), 'icon' => 'plus-circle', 'link' => '#/pages/add/', 'key' => '+');
}
return array('title' => array('text' => l('dashboard.index.pages.title'), 'link' => '#/subpages/index/', 'compressed' => true), 'options' => $options, 'html' => function () use($pages) {
return tpl::load(__DIR__ . DS . 'pages.html.php', array('pages' => $pages));
});