當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Page::active方法代碼示例

本文整理匯總了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;
 }
開發者ID:jetcms,項目名稱:website,代碼行數:34,代碼來源:PageController.php

示例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;
 }
開發者ID:jetcms,項目名稱:website,代碼行數:15,代碼來源:FeedController.php

示例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;
 }
開發者ID:vasiliy-mk,項目名稱:apartment-rent,代碼行數:24,代碼來源:Settings.php

示例4: getData

 protected function getData()
 {
     return Page::active()->with('user')->get();
 }
開發者ID:jetcms,項目名稱:website,代碼行數:4,代碼來源:SitemapController.php


注:本文中的app\Page::active方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。