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


PHP Translatable::get_one方法代码示例

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


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

示例1: getNestedController

 public function getNestedController()
 {
     if ($this->urlParams['URLSegment']) {
         $SQL_URLSegment = Convert::raw2sql($this->urlParams['URLSegment']);
         if (Translatable::is_enabled()) {
             $child = Translatable::get_one("SiteTree", "URLSegment = '{$SQL_URLSegment}'");
         } else {
             $child = DataObject::get_one("SiteTree", "URLSegment = '{$SQL_URLSegment}'");
         }
         if (!$child) {
             $child = $this->get404Page();
         }
         if ($child) {
             if (isset($_REQUEST['debug'])) {
                 Debug::message("Using record #{$child->ID} of type {$child->class} with URL {$this->urlParams['URLSegment']}");
             }
             $controllerClass = "{$child->class}_Controller";
             if ($this->urlParams['Action'] && ClassInfo::exists($controllerClass . '_' . $this->urlParams['Action'])) {
                 $controllerClass = $controllerClass . '_' . $this->urlParams['Action'];
             }
             if (ClassInfo::exists($controllerClass)) {
                 $controller = new $controllerClass($child);
             } else {
                 $controller = $child;
             }
             $controller->setURLParams($this->urlParams);
             return $controller;
         } else {
             die("The requested page couldn't be found.");
         }
     } else {
         user_error("ModelAsController not geting a URLSegment.  It looks like the site isn't redirecting to home", E_USER_ERROR);
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:34,代码来源:ModelAsController.php

示例2: currentPage

 static function currentPage()
 {
     if (isset(Director::$urlParams['URLSegment'])) {
         $SQL_urlSegment = Convert::raw2sql(Director::$urlParams['URLSegment']);
         if (Translatable::is_enabled()) {
             return Translatable::get_one("SiteTree", "URLSegment = '{$SQL_urlSegment}'");
         } else {
             return DataObject::get_one("SiteTree", "URLSegment = '{$SQL_urlSegment}'");
         }
     } else {
         return Controller::curr();
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:13,代码来源:Director.php


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