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


PHP Pages::addPage方法代码示例

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


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

示例1: signupAction

 public function signupAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->addErrorMessage("Form was not properly posted.");
         $this->_forward('index');
     }
     // Retrieve the form values and its values
     $form = $this->getForm();
     $valid = $form->isValid($_POST);
     $values = $form->getValues();
     $username = $values['username'];
     $email = $values['email'];
     $password = $values['password'];
     // Validate the form itself
     if (!$form->isValid($_POST)) {
         // Failed validation; redisplay form
         $this->view->form = $form;
         $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again");
         return $this->_forward('register');
     }
     // Register user
     $users = new Users();
     $user = $users->addUser($username, $password, $email);
     // Add some default widgets to the user
     $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id));
     $widgets->addWidget('search');
     $widgets->addWidget('rsslink');
     $widgets->addWidget('links');
     $widgets->addWidget('lastcomments');
     $widgets->addWidget('archives');
     $widgets->addWidget('logo');
     // Add some default properties
     $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
     $properties->setProperty('theme', 'clouds');
     $properties->setProperty('title', ucfirst($username));
     $properties->setProperty('subtitle', "my life online");
     // Add the storytlr data source
     StuffpressModel::forUser($user->id);
     // Add default pages
     $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id));
     //$pages->addPage('dashboard', 'Home');
     $pages->addPage('lifestream', 'Stream');
     $pages->addPage('stories', 'Stories');
     // Send the user a verification email
     Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token);
     // Done !
     $this->view->username = $username;
     $this->view->email = $email;
     $this->render('success');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:50,代码来源:RegisterController.php

示例2: Pages

<?php

include "classes/Pages.php";
include "classes/Translation.php";
$p = new Pages($_GET['page']);
$p->addPage("divider1", "<b>" . $t->tr("Legende") . "</b>-----------------------", "");
$p->addPage("harbour", $t->tr("harbour"), "harbour.php");
$p->addPage("seamark", $t->tr("Seezeichen"), "seamark.php");
$p->addPage("light", $t->tr("Leuchtfeuer"), "light.php");
$p->addPage("lock", $t->tr("BrückenSchleusen"), "lock.php");
$p->addPage("divider2", "<b>" . $t->tr("help") . "</b>------------------------------", "");
$p->addPage("help-josm", $t->tr("help-josm"), "./map_key_pages/help-josm_" . $t->tr("langCode") . ".php");
$p->addPage("help-tidal-scale", $t->tr("help-tidal-scale"), "./map_key_pages/help-tidal-scale_" . $t->tr("langCode") . ".php");
$p->addPage("help-trip-planner", $t->tr("tripPlanner"), "./map_key_pages/help-trip-planner_" . $t->tr("langCode") . ".php");
$p->addPage("help-website", $t->tr("help-website-int"), "./map_key_pages/help-web-integr_" . $t->tr("langCode") . ".php");
$p->addPage("help-online", $t->tr("help-online"), "./map_key_pages/help-online_" . $t->tr("langCode") . ".php");
$p->addPage("divider3", "------------------------------------", "");
$p->addPage("license", $t->tr("license"), "./map_key_pages/license_" . $t->tr("langCode") . ".php");
$p->addPage("about", $t->tr("about"), "./map_key_pages/about_" . $t->tr("langCode") . ".php");
$p->setDefaultPage("harbour");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>OSW -<?php 
echo $t->tr('nautical_chart');
?>
: <?php 
echo $t->tr("Legende");
开发者ID:FrankKooij,项目名称:online_chart,代码行数:31,代码来源:legend.php

示例3:

	</div>
	
	<div id="container">
	
	<?php 
    if (isset($_POST['addnew'])) {
        echo '<p class="message success">Page Added</p>';
        if (isset($_POST['innav'])) {
            $innav = 'on';
        } else {
            $innav = 'off';
        }
        if (isset($_POST['cfield'])) {
            Pages::addPage($_POST['title'], $_POST['body'], $_POST['template'], $_POST['rewrite'], $innav, $_POST['cfield']);
        } else {
            Pages::addPage($_POST['title'], $_POST['body'], $_POST['template'], $_POST['rewrite'], $innav);
        }
    }
    ?>
	
	<?php 
    if (isset($_POST['update'])) {
        if (isset($_POST['innav'])) {
            $innav = 'on';
        } else {
            $innav = 'off';
        }
        if (isset($_POST['cfield'])) {
            Pages::updatePage($_POST['title'], $_POST['body'], $_POST['rewrite'], $_POST['template'], $innav, $_POST['id'], $_POST['cfield']);
        } else {
            Pages::updatePage($_POST['title'], $_POST['body'], $_POST['rewrite'], $_POST['template'], $innav, $_POST['id']);
开发者ID:ringmaster,项目名称:CandyCMS,代码行数:31,代码来源:pages.php

示例4: saveAction

 public function saveAction()
 {
     // We'll need to access the pages database
     $pages = new Pages();
     // Is the form correctly posted ?
     if (!$this->getRequest()->isPost()) {
         throw new Stuffpress_Exception("Invalid request - must be post");
     }
     // Get the source from the request
     $id = (int) $this->_getParam('id');
     $type = (string) $this->_getParam('type');
     // Validate the parameters
     if (!($id >= 0 && in_array($type, Pages::getAvailablePages()))) {
         throw new Stuffpress_Exception("Parameters failed validation");
     }
     // If it is an edit; are we the owner ?
     if ($id > 0) {
         // Does the page exist ?
         if (!($page = $pages->getPage($id))) {
             throw new Stuffpress_Exception("Unknown page with id {$id}");
         }
         // Are we the owner ?
         if ($page['user_id'] != $this->_application->user->id) {
             throw new Stuffpress_AccessDeniedException("Not the owner of page {$id}");
         }
     }
     // Get the page descriptor
     $model = Pages::getModel($type);
     // Validate the form
     $form = $model->getForm();
     if (!$form->isValid($_POST)) {
         return $this->_helper->json->sendJson($form->getErrorArray());
     }
     // Get the form values
     $values = $form->getValues();
     // Proceed and save the values
     $title = @$values['title'];
     // There shoudl always be a title
     // Create the page if it does not exist
     if ($id == 0) {
         $id = $pages->addPage($type, $title);
     } else {
         $pages->setTitle($id, $title);
     }
     // Save the page configuration
     $model->processForm($id, $values);
     // Ok
     return $this->_helper->json->sendJson(false);
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:49,代码来源:PagesController.php


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