本文整理汇总了PHP中app\Page::active方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::active方法的具体用法?PHP Page::active怎么用?PHP Page::active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::active方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pageCreateView
public function pageCreateView($context, $alias, $value = [])
{
$menuLevel = [];
$page = $this->pageModel($context, $alias);
SEO::setTitle($page->title);
SEO::setDescription($page->description);
if ($page->image) {
SEO::addImages(asset($page->image));
}
$value['page'] = $page;
if ($page->comments and $this->view_comments) {
$page->load('comments', 'comments.user');
$value['comments'] = $page->comments;
}
$value['view_comments'] = $this->view_comments;
if ($page->menu) {
$page->menu->setActiveThis();
$menuLevel = $page->menu->getMapLevel(true);
if ($this->list) {
$childs = $page->menu->getChildsId(true);
$list = Page::active()->where('context', $this->list)->whereIn('menu_id', $childs)->sort()->with('user', 'fields', 'tag')->paginate(15);
$value['list'] = $list;
}
}
foreach ($menuLevel as $key => $val) {
$value['menu_level_' . $key] = $val;
}
if ($this->template) {
$view = $this->view($this->template, $value);
} else {
$view = $this->view('tpl.' . $page->template, $value);
}
return $view;
}
示例2: addItem
protected function addItem($feed)
{
$pages = Page::active()->get();
if ($pages) {
foreach ($pages as $key => $page) {
if ($key == 0) {
$feed->pubdate = $page->created_at->toDateTimeString();
}
// set item's title, author, url, pubdate, description and content
//$author = ;
$feed->add($page->title, $page->user ? $page->user->name : $this->default_author, URL::to($page->url), $page->publish, $page->description, $page->content);
}
}
return $feed;
}
示例3: makeArray
private static function makeArray()
{
$settings = Settings::get()->toArray();
// insert default settings if first run application
if (!$settings) {
self::createDefault();
User::createDefault();
$arr = self::$default;
} else {
foreach ($settings as $item) {
$name = $item['name'];
$array_value = json_decode($item['value']);
$value = $array_value ? $array_value : $item['value'];
$arr[$name] = $value;
}
}
// Front navbar menu
$arr['page_menu'] = Page::active()->where('to_menu', 1)->orderBy('sorter')->get()->lists('name', 'slug');
// admin credentials
$user = User::find(1);
$arr['name'] = $user->name;
$arr['admin_email'] = $user->email;
return $arr;
}
示例4: getData
protected function getData()
{
return Page::active()->with('user')->get();
}