本文整理汇总了PHP中Pages::getPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::getPage方法的具体用法?PHP Pages::getPage怎么用?PHP Pages::getPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::getPage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initPage
protected function initPage()
{
// If no page id, we have a problem
$page_id = $this->getRequest()->getParam("pid");
// If the page does not exist, we have a problem
$pages = new Pages();
if ($page = $pages->getPage($page_id)) {
$this->_page = $page;
}
// get the page properties
if ($page) {
$this->_page_properties = new PagesProperties(array(PagesProperties::KEY => $page['id']));
$this->view->page_id = $this->_page['id'];
$this->view->page_title = $this->_page['title'];
} else {
$this->view->page_id = false;
}
// Get the tab for further use
if ($tab = (int) $this->getRequest()->getParam("tab")) {
$this->view->tab = $tab;
}
// Prepare the view
$this->_helper->layout->setLayoutPath($this->_root . '/application/public/views/layouts/')->setlayout('default');
$this->view->page_class = $this->_prefix;
}
示例2: listAction
public function listAction()
{
$pages = new Pages($this->getSiteId());
foreach ($this->existConstants as $key => $const) {
if ($const['c_name'] == 'un404page' || $const['c_name'] == 'loginPage') {
$page = $pages->getPage($const['c_value']);
$this->existConstants[$key]['c_value'] = $page->address['uri_address'];
}
}
$this->tplVars['consts']['consts'] = $this->existConstants;
array_push($this->tplVars['page_css'], 'pages.css');
array_push($this->viewIncludes, 'constants/listConstants.tpl');
}
示例3: editAction
public function editAction()
{
if ($this->_hasParam('id')) {
$pageId = $this->_getParam('id');
$content = new Content($this->getSiteId(), $pageId);
$pages = new Pages($this->getSiteId());
$page = $pages->getPage($pageId);
$html = '';
$this->renderBlocksHTML($content, $html);
// $this->tplVars['page_js'][] = 'tiny_mce/tiny_mce.js';
$this->tplVars['page_js'][] = 'jquery-1.8.3.js';
//italiano, 21/09/2015
$this->tplVars['page_js'][] = 'colorbox.js';
$this->tplVars['page_js'][] = 'jquery.scroll.js';
$this->tplVars['page_js'][] = 'content.js';
$this->tplVars['page_js'][] = 'jquery.filetree.js';
$this->tplVars['page_js'][] = 'jquery.dimensions.js';
$this->tplVars['page_js'][] = 'browser.js';
$this->tplVars['page_js'][] = 'ui.core.min.js';
$this->tplVars['page_js'][] = 'ui.draggable.min.js';
$this->tplVars['page_js'][] = 'ui.droppable.min.js';
$this->tplVars['page_css'][] = 'browser.css';
$this->tplVars['page_css'][] = 'jquery_file_tree.css';
$this->tplVars['page_css'][] = 'colorbox.css';
$this->tplVars['content']['siteHostname'] = $this->getNCSiteHostname();
$this->tplVars['content']['pageAddress'] = $page->address['uri_address'];
$this->tplVars['content']['pageId'] = $pageId;
$this->tplVars['content']['cached'] = $content->chekingCacheFile($page->address['uri_address']);
$this->tplVars['content']['blocksList'] = $html;
$this->tplVars['header']['actions']['names'][] = array('name' => 'params', 'menu_name' => 'Edit page', 'params' => array('id' => $pageId));
$this->tplVars['header']['actions']['names'][] = array('name' => 'meta', 'menu_name' => 'Edit page meta', 'params' => array('id' => $pageId));
$this->tplVars['header']['actions']['names'][] = array('name' => 'edit', 'menu_name' => 'Edit content', 'params' => array('id' => $pageId));
array_push($this->viewIncludes, 'content/blocks/blocksList.tpl');
}
}
示例4: function
<?php
/**
* Breadcrumb Plugin
* Based on idea from https://github.com/tovic/breadcrumb-plugin-for-fansoro-cms
*
* @package Fansoro
* @subpackage Plugins
* @author Pavel Belousov / pafnuty
* @version 1.1.0
* @license https://github.com/pafnuty-fansoro-plugins/fansoro-plugin-breadcrumb/blob/master/LICENSE MIT
*/
Action::add('breadcrumb', function () {
// Configuration data
$config = Config::get('plugins.breadcrumb');
// Get current URI segments
$paths = Url::getUriSegments();
// Count total paths
$total_paths = count($paths);
// Path lifter
$lift = '';
// Breadcrumb's data
$data = [];
for ($i = 0; $i < $total_paths; $i++) {
$lift .= '/' . $paths[$i];
$page = Pages::getPage(file_exists(STORAGE_PATH . '/pages/' . $lift . '/index.md') || file_exists(STORAGE_PATH . '/pages/' . $lift . '.md') ? $lift : '404');
$data[Url::getBase() . $lift] = ['title' => $page['title'], 'current' => rtrim(Url::getCurrent(), '/') === rtrim(Url::getBase() . $lift, '/')];
}
$template = Template::factory(THEMES_PATH . '/' . Config::get('system.theme'));
$template->display('/plugins/breadcrumb/breadcrumb.tpl', ['home' => rtrim(Url::getCurrent(), '/') === rtrim(Url::getBase(), '/') ? true : Url::getBase(), 'config' => $config, 'branch' => $data]);
});
示例5: function
* Template: api.tpl
* Link blog: api?action=blog
* link by page:api?action=contact
*/
Action::add('Api', function () {
//print_r(json_encode(Config::getConfig(),true));
if (Request::get('type')) {
cors();
Request::setHeaders('Content-Type: application/json; charset=' . Config::get('system.charset'));
$result = '';
switch (Request::get('type')) {
case 'page':
// api?type=page&name=blog/hello get all
if (Request::get('name')) {
// get page name
$p = @Pages::getPage(Request::get('name'));
$title = isset($p['title']) ? $p['title'] : '';
$date = isset($p['date']) ? $p['date'] : '';
$slug = isset($p['slug']) ? $p['slug'] : '';
$url = isset($p['url']) ? $p['url'] : '';
$tag = isset($p['tag']) ? $p['tag'] : '';
$thumbnail = isset($p['thumbnail']) ? $p['thumbnail'] : '';
$template = isset($p['template']) ? $p['template'] : '';
$summary = isset($p['summary']) ? $p['summary'] : '';
$content = isset($p['content']) ? $p['content'] : '';
$keywords = isset($p['keywords']) ? $p['keywords'] : '';
$description = isset($p['description']) ? $p['description'] : '';
// api?type=page&name=blog/hello&filter=title get only title
if (Request::get('filter')) {
switch (Request::get('filter')) {
// api?type=page&name=blog/hello&filter=title
示例6: deleteAction
public function deleteAction()
{
// Get, check and setup the parameters
$page_id = $this->getRequest()->getParam("id");
// Do we own the page ?
$pages = new Pages();
if (!($page = $pages->getPage($page_id))) {
throw new Stuffpress_Exception("Unknown page with id {$page_id}");
}
if ($page['user_id'] != $this->_application->user->id) {
throw new Stuffpress_AccessDeniedException("Not the owner of page {$page_id}");
}
$pages->deletePage($page_id);
// Delete the page properties
$properties = new PagesProperties(array(Properties::KEY => $page_id));
$properties->deleteAllProperties();
return $this->_helper->json->sendJson(false);
}