本文整理汇总了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');
}
示例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));
}
示例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);
}
示例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();
}
示例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);
}
示例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));
}
示例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')));
}
}
示例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']);
}
}
}
示例9: page
static function page($slug)
{
$page = Pages::where('slug', '=', $slug)->first();
$page = Pages::find($page->id);
return $page;
}
示例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);
}
}
示例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');
}
示例12: actionIndex
public function actionIndex()
{
return Pages::find();
}
示例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'));
}
示例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);
}