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


PHP Subsite::write方法代码示例

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


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

示例1: doCreate

 function doCreate($data, $form, $request)
 {
     if (isset($data['TemplateID']) && $data['TemplateID']) {
         $template = DataObject::get_by_id('Subsite_Template', $data['TemplateID']);
     } else {
         $template = null;
     }
     // Create subsite from existing template
     switch ($data['Type']) {
         case 'template':
             if ($template) {
                 $subsite = $template->duplicate();
             } else {
                 $subsite = new Subsite_Template();
                 $subsite->write();
             }
             break;
         case 'subsite':
         default:
             if ($template) {
                 $subsite = $template->createInstance($data['Title']);
             } else {
                 $subsite = new Subsite();
                 $subsite->Title = $data['Title'];
                 $subsite->write();
             }
             break;
     }
     $form->dataFieldByName('Domains')->setExtraData(array("SubsiteID" => $subsite->ID));
     $form->saveInto($subsite);
     $subsite->write();
     if (Director::is_ajax()) {
         $recordController = new ModelAdmin_RecordController($this, $request, $subsite->ID);
         return new SS_HTTPResponse($recordController->EditForm()->forAjaxTemplate(), 200, sprintf(_t('ModelAdmin.LOADEDFOREDITING', "Loaded '%s' for editing."), $subsite->Title));
     } else {
         Director::redirect(Controller::join_links($this->Link(), $subsitess->ID, 'edit'));
     }
 }
开发者ID:hafriedlander,项目名称:silverstripe-config-experiment,代码行数:38,代码来源:SubsiteAdmin.php

示例2: createSubsiteWithDomains

 protected function createSubsiteWithDomains($domains)
 {
     $subsite = new Subsite(array('Title' => 'My Subsite'));
     $subsite->write();
     foreach ($domains as $domainStr => $isPrimary) {
         $domain = new SubsiteDomain(array('Domain' => $domainStr, 'IsPrimary' => $isPrimary, 'SubsiteID' => $subsite->ID));
         $domain->write();
     }
     return $subsite;
 }
开发者ID:helpfulrobot,项目名称:mikenz-silverstripe-simplesubsites,代码行数:10,代码来源:SubsiteTest.php


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