本文整理汇总了PHP中SiteTree::set_create_default_pages方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteTree::set_create_default_pages方法的具体用法?PHP SiteTree::set_create_default_pages怎么用?PHP SiteTree::set_create_default_pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteTree
的用法示例。
在下文中一共展示了SiteTree::set_create_default_pages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateDefaultpages
function testCreateDefaultpages() {
$remove = DataObject::get('SiteTree');
if($remove) foreach($remove as $page) $page->delete();
// Make sure the table is empty
$this->assertEquals(DB::query('SELECT COUNT("ID") FROM "SiteTree"')->value(), 0);
// Disable the creation
SiteTree::set_create_default_pages(false);
singleton('SiteTree')->requireDefaultRecords();
// The table should still be empty
$this->assertEquals(DB::query('SELECT COUNT("ID") FROM "SiteTree"')->value(), 0);
// Enable the creation
SiteTree::set_create_default_pages(true);
singleton('SiteTree')->requireDefaultRecords();
// The table should now have three rows (home, about-us, contact-us)
$this->assertEquals(DB::query('SELECT COUNT("ID") FROM "SiteTree"')->value(), 3);
}
示例2:
* Copyright 2013 pixeltricks GmbH
*
* This file is part of SilverCart.
*
* @package Silvercart
* @subpackage Config
* @ignore
*/
// ----------------------------------------------------------------------------
// Define required attributes
// ----------------------------------------------------------------------------
SilvercartProduct::addRequiredAttribute("Price");
// ----------------------------------------------------------------------------
// disable default pages for SiteTree
// ----------------------------------------------------------------------------
SiteTree::set_create_default_pages(false);
// ----------------------------------------------------------------------------
// Add some URL rules for custom controllers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Set spam check for forms
// ----------------------------------------------------------------------------
CustomHtmlForm::useSpamCheckFor('SilvercartContactForm');
CustomHtmlForm::useSpamCheckFor('SilvercartRevocationForm');
CustomHtmlForm::$custom_error_box_css_class = 'help-inline';
CustomHtmlForm::$custom_error_box_selection_method = 'append';
CustomHtmlForm::$custom_error_box_sub_selector = ' .controls';
// Require i18n javascript
Requirements::add_i18n_javascript('silvercart/javascript/lang');
// ----------------------------------------------------------------------------
// Register SilvercartPluginProvider