当前位置: 首页>>代码示例>>PHP>>正文


PHP Pages::find方法代码示例

本文整理汇总了PHP中Pages::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::find方法的具体用法?PHP Pages::find怎么用?PHP Pages::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pages的用法示例。


在下文中一共展示了Pages::find方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: page

 public function page($slug = '')
 {
     // allow admin to view unpublished posts
     if (Users::authed() === false) {
         $params['status'] = 'published';
     }
     // if no slug is set we will use our default page
     if (empty($slug)) {
         $params['id'] = Config::get('metadata.home_page');
     } else {
         $params['slug'] = $slug;
     }
     // if we cant find either it looks like we're barney rubble (in trouble)
     if (($page = Pages::find($params)) === false) {
         return Response::error(404);
     }
     // store our page for template functions
     IoC::instance('page', $page, true);
     // does the current page host our posts?
     if ($page->id == Config::get('metadata.posts_page')) {
         // render our posts template
         return Template::render('posts');
     }
     // render our page template
     Template::render('page');
 }
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:26,代码来源:routes.php

示例2: edit

 public function edit($id)
 {
     // find article
     if (($article = Posts::find(array('id' => $id))) === false) {
         return Response::redirect($this->admin_url . '/posts');
     }
     // process post request
     if (Input::method() == 'POST') {
         if (Posts::update($id)) {
             // redirect path
             return Response::redirect($this->admin_url . '/posts/edit/' . $id);
         }
     }
     // get comments
     $comments = Comments::list_all(array('post' => $id));
     $pending = array();
     foreach ($comments as $comment) {
         if ($comment->status == 'pending') {
             $pending[] = $comment->id;
         }
     }
     $pending = count($pending);
     // get posts page
     $page = Pages::find(array('id' => Config::get('metadata.posts_page')));
     Template::render('posts/edit', array('article' => $article, 'comments' => $comments, 'page' => $page, 'pending' => $pending));
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:26,代码来源:posts.php

示例3: setup

 private static function setup()
 {
     // Query metadata and store into our config
     $sql = "select `key`, `value` from meta";
     Config::set('metadata', Db::pairs($sql));
     // look up which page has our posts
     $page = Pages::find(array('id' => Config::get('metadata.posts_page')));
     IoC::instance('posts_page', $page, true);
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:9,代码来源:anchor.php

示例4: szczegolyAction

 function szczegolyAction()
 {
     $oRequest = $this->getRequest();
     $iPages = $oRequest->getParam('id');
     $oPages = new Pages();
     $this->view->oPages = $oPages->find($iPages)->current();
     $strony = new Strony();
     $this->view->strony = $strony->fetchAll();
 }
开发者ID:stasiu38,项目名称:cms,代码行数:9,代码来源:IndexController.php

示例5: setup

 private static function setup()
 {
     // Query metadata and store into our config
     $sql = "select `key`, `value` from meta";
     $meta = array();
     foreach (Db::results($sql) as $row) {
         $meta[$row->key] = $row->value;
     }
     Config::set('metadata', $meta);
     // look up which page has our posts
     $page = Pages::find(array('id' => Config::get('metadata.posts_page')));
     IoC::instance('posts_page', $page, true);
 }
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:13,代码来源:anchor.php

示例6: edit

 public function edit($id)
 {
     // find page
     if (($page = Pages::find(array('id' => $id))) === false) {
         return Response::redirect($this->admin_url . '/pages');
     }
     // process post request
     if (Input::method() == 'POST') {
         if (Pages::update($id)) {
             // redirect path
             return Response::redirect($this->admin_url . '/pages/edit/' . $id);
         }
     }
     Template::render('pages/edit', array('page' => $page));
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:15,代码来源:pages.php

示例7: savepage

 public function savepage()
 {
     if (Input::get('pageid')) {
         $page = Pages::find(Input::get('pageid'));
     } else {
         $page = new Pages();
     }
     $page->slug = Input::get('page_slug');
     $page->title = Input::get('title');
     $page->subtitle = Input::get('subtitle');
     $page->content = Input::get('content');
     $page->status = Input::get('status');
     $page->save();
     if (Input::get('saveclose')) {
         return Redirect::to('backend/pages/')->withMessage($this->notifyView(Lang::get('laracms::messages.page_saved')));
     } else {
         return Redirect::to('backend/editpage/' . $page->id)->withMessage($this->notifyView(Lang::get('laracms::messages.page_saved')));
     }
 }
开发者ID:basdog22,项目名称:laracms,代码行数:19,代码来源:LaraBackendController.php

示例8: setOrderPosition

 public function setOrderPosition($item, $parent = 0)
 {
     $page = Pages::find($item['id']);
     $page->order = $this->position++;
     $page->id_parent = $parent;
     $page->save();
     if (isset($item['children'])) {
         foreach ($item['children'] as $subitem) {
             # code...
             $this->setOrderPosition($subitem, $item['id']);
         }
     }
 }
开发者ID:nagyist,项目名称:abge,代码行数:13,代码来源:PageController.php

示例9: page

 static function page($slug)
 {
     $page = Pages::where('slug', '=', $slug)->first();
     $page = Pages::find($page->id);
     return $page;
 }
开发者ID:basdog22,项目名称:laracms,代码行数:6,代码来源:Pages.php

示例10: postViewPage

 public function postViewPage($id)
 {
     if (Session::get('group_id') == '100') {
         Auth::logout();
         Session::flush();
         header("HTTP/1.1 404 Page Not Found", true, 404);
         exit("You cannot do this.");
     } else {
         $result = Pages::find($id);
         $name = time() . '_faxpage.pdf';
         $data['filepath'] = __DIR__ . '/../../public/temp/' . $name;
         copy($result->file, $data['filepath']);
         $data['html'] = '<iframe src="' . asset('temp/' . $name) . '" width="770" height="425" style="border: none;"></iframe>';
         echo json_encode($data);
     }
 }
开发者ID:carlosqueiroz,项目名称:nosh-core,代码行数:16,代码来源:AjaxMessagingController.php

示例11: postDestroy

 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     $ids = Input::get('id');
     for ($i = 0; $i < count($ids); $i++) {
         $row = Pages::find($ids[$i]);
         $filename = public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php";
         if (file_exists($filename) && $row->filename != '') {
             unlink(public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php");
         }
     }
     // delete multipe rows
     $data = $this->model->destroy(Input::get('id'));
     self::createRouters();
     Session::flash('message', SiteHelpers::alert('success', 'Successfully deleted row!'));
     return Redirect::to('pages');
 }
开发者ID:buguelos,项目名称:make,代码行数:19,代码来源:PagesController.php

示例12: actionIndex

 public function actionIndex()
 {
     return Pages::find();
 }
开发者ID:hogvarce,项目名称:base,代码行数:4,代码来源:PagesController.php

示例13: findSubpages

 /**
  * Return subpages
  *
  * @param Page $page
  * @param integer $min_state
  * @param integer $min_visibility
  * @return array
  */
 function findSubpages($page, $min_state = STATE_VISIBLE, $min_visibility = VISIBILITY_NORMAL)
 {
     return Pages::find(array('conditions' => array('parent_id = ? AND type = ? AND state >= ? AND visibility >= ?', $page->getId(), 'Page', $min_state, $min_visibility, false), 'order' => 'ISNULL(position) ASC, position'));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:12,代码来源:Pages.class.php

示例14: page

 public function page($id)
 {
     $mdPage = new Pages();
     $item = $mdPage->find($id);
     $data['page'] = $item;
     $this->data['pageTitle'] = $item->title;
     $this->data['pageNote'] = CNF_APPNAME;
     //$this->data['breadcrumb'] = 'inactive';
     $page = 'pages.template.index';
     $page = SiteHelpers::renderHtml($page);
     $this->layout->nest('content', $page, $data)->with('page', $this->data);
 }
开发者ID:blackorwhite1233,项目名称:fakekinhdoanh,代码行数:12,代码来源:HomeController.php


注:本文中的Pages::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。