本文整理匯總了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