CTheme

优质
小牛编辑
126浏览
2023-12-01
所有包 | 属性 | 方法
system.web
继承class CTheme » CComponent
源自1.0
版本$Id: CTheme.php 3426 2011-10-25 00:01:09Z alexander.makarow $
源码framework/web/CTheme.php
CTheme表示一个应用程序主题。

公共属性

隐藏继承属性

属性类型描述定义在
basePathstring主题文件夹路径CTheme
baseUrlstring主题文件夹相对URL(没有结尾反斜线)CTheme
namestring主题名称CTheme
skinPathstring小部件皮肤路径。默认是‘ThemeRoot/views/skins’。CTheme
systemViewPathstring系统视图路径。默认是‘ThemeRoot/views/system’。CTheme
viewPathstring控制器视图路径。默认是‘ThemeRoot/views’。CTheme

公共方法

隐藏继承方法

方法描述定义在
__call()如果类中没有调的方法名,则调用这个方法。CComponent
__construct()构造方法。CTheme
__get()返回一个属性值、一个事件处理程序列表或一个行为名称。CComponent
__isset()检查一个属性是否为null。CComponent
__set()设置一个组件的属性值。CComponent
__unset()设置一个组件的属性为null。CComponent
asa()返回这个名字的行为对象。CComponent
attachBehavior()附加一个行为到组件。CComponent
attachBehaviors()附加一个行为列表到组件。CComponent
attachEventHandler()为事件附加一个事件处理程序。CComponent
canGetProperty()确定属性是否可读。CComponent
canSetProperty()确定属性是否可写。CComponent
detachBehavior()从组件中分离一个行为。CComponent
detachBehaviors()从组件中分离所有行为。CComponent
detachEventHandler()分离一个存在的事件处理程序。CComponent
disableBehavior()禁用一个附加行为。CComponent
disableBehaviors()禁用组件附加的所有行为。CComponent
enableBehavior()启用一个附加行为。CComponent
enableBehaviors()启用组件附加的所有行为。CComponent
evaluateExpression()计算一个PHP表达式,或根据组件上下文执行回调。CComponent
getBasePath()返回主题文件夹路径CTheme
getBaseUrl()返回主题文件夹相对URL(没有结尾反斜线)CTheme
getEventHandlers()返回一个事件的附加处理程序列表。CComponent
getLayoutFile()查找指定控制器的布局的布局文件。CTheme
getName()返回主题名称CTheme
getSkinPath()返回小部件皮肤路径。默认是‘ThemeRoot/views/skins’。CTheme
getSystemViewPath()返回系统视图路径。默认是‘ThemeRoot/views/system’。CTheme
getViewFile()查找指定控制器的视图的视图文件。CTheme
getViewPath()返回控制器视图路径。默认是‘ThemeRoot/views’。CTheme
hasEvent()确定一个事件是否定义。CComponent
hasEventHandler()检查事件是否有附加的处理程序。CComponent
hasProperty()确定属性是否被定义。CComponent
raiseEvent()发起一个事件。CComponent

属性详细

basePath 属性 只读 public string getBasePath()

主题文件夹路径

baseUrl 属性 只读 public string getBaseUrl()

主题文件夹相对URL(没有结尾反斜线)

name 属性 只读 public string getName()

主题名称

skinPath 属性 只读 (可用自 v1.1) public string getSkinPath()

小部件皮肤路径。默认是‘ThemeRoot/views/skins’。

systemViewPath 属性 只读 public string getSystemViewPath()

系统视图路径。默认是‘ThemeRoot/views/system’。

viewPath 属性 只读 public string getViewPath()

控制器视图路径。默认是‘ThemeRoot/views’。

方法详细

__construct() 方法
public void __construct(string $name, string $basePath, string $baseUrl)
$namestring主题名称
$basePathstring基本主题路径
$baseUrlstring基本主题URL
源码: framework/web/CTheme.php#38 (显示) publicfunction__construct($name,$basePath,$baseUrl)
{
$this->_name=$name;
$this->_baseUrl=$baseUrl;
$this->_basePath=$basePath;
}

构造方法。

getBasePath() 方法
public string getBasePath()
{return}string主题文件夹路径
源码: framework/web/CTheme.php#64 (显示) publicfunctiongetBasePath()
{
return$this->_basePath;
}
getBaseUrl() 方法
public string getBaseUrl()
{return}string主题文件夹相对URL(没有结尾反斜线)
源码: framework/web/CTheme.php#56 (显示) publicfunctiongetBaseUrl()
{
return$this->_baseUrl;
}
getLayoutFile() 方法
public string getLayoutFile(CController $controller, string $layoutName)
$controllerCController控制器
$layoutNamestring布局名称
{return}string布局文件路径。如果文件不存在为false。
源码: framework/web/CTheme.php#114 (显示) publicfunctiongetLayoutFile($controller,$layoutName)
{
$moduleViewPath=$basePath=$this->getViewPath();
$module=$controller->getModule();
if(empty($layoutName))
{
while($module!==null)
{
if($module->layout===false)
returnfalse;
if(!empty($module->layout))
break;
$module=$module->getParentModule();
}
if($module===null)
$layoutName=Yii::app()->layout;
else
{
$layoutName=$module->layout;
$moduleViewPath.='/'.$module->getId();
}
}
elseif($module!==null)
$moduleViewPath.='/'.$module->getId();

return$controller->resolveViewFile($layoutName,$moduleViewPath.'/layouts',$basePath,$moduleViewPath);
}

查找指定控制器的布局的布局文件。

getName() 方法
public string getName()
{return}string主题名称
源码: framework/web/CTheme.php#48 (显示) publicfunctiongetName()
{
return$this->_name;
}
getSkinPath() 方法 (可用自 v1.1)
public string getSkinPath()
{return}string小部件皮肤路径。默认是‘ThemeRoot/views/skins’。
源码: framework/web/CTheme.php#89 (显示) publicfunctiongetSkinPath()
{
return$this->getViewPath().DIRECTORY_SEPARATOR.'skins';
}
getSystemViewPath() 方法
public string getSystemViewPath()
{return}string系统视图路径。默认是‘ThemeRoot/views/system’。
源码: framework/web/CTheme.php#80 (显示) publicfunctiongetSystemViewPath()
{
return$this->getViewPath().DIRECTORY_SEPARATOR.'system';
}
getViewFile() 方法
public string getViewFile(CController $controller, string $viewName)
$controllerCController控制器
$viewNamestring视图名称
{return}string视图文件路径。如果文件不存在为false。
源码: framework/web/CTheme.php#100 (显示) publicfunctiongetViewFile($controller,$viewName)
{
$moduleViewPath=$this->getViewPath();
if(($module=$controller->getModule())!==null)
$moduleViewPath.='/'.$module->getId();
return$controller->resolveViewFile($viewName,$this->getViewPath().'/'.$controller->getUniqueId(),$this->getViewPath(),$moduleViewPath);
}

查找指定控制器的视图的视图文件。

getViewPath() 方法
public string getViewPath()
{return}string控制器视图路径。默认是‘ThemeRoot/views’。
源码: framework/web/CTheme.php#72 (显示) publicfunctiongetViewPath()
{
return$this->_basePath.DIRECTORY_SEPARATOR.'views';
}