CTheme
CTheme represents an application theme.
Public Properties
Property |
Type |
Description |
Defined By |
basePath | string | the file path to the theme folder | CTheme |
baseUrl | string | the relative URL to the theme folder (without ending slash) | CTheme |
name | string | theme name | CTheme |
skinPath | string | the path for widget skins. | CTheme |
systemViewPath | string | the path for system views. | CTheme |
viewPath | string | the path for controller views. | CTheme |
Property Details
public string getBasePath()
the file path to the theme folder
public string getBaseUrl()
the relative URL to the theme folder (without ending slash)
public string getName()
theme name
public string getSkinPath()
the path for widget skins. Defaults to 'ThemeRoot/views/skins'.
public string getSystemViewPath()
the path for system views. Defaults to 'ThemeRoot/views/system'.
public string getViewPath()
the path for controller views. Defaults to 'ThemeRoot/views'.
Method Details
public void __construct(string $name, string $basePath, string $baseUrl) |
$name | string | name of the theme |
$basePath | string | base theme path |
$baseUrl | string | base theme URL |
Source Code: framework/web/CTheme.php#37 (
show)
public function __construct($name,$basePath,$baseUrl)
{
$this->_name=$name;
$this->_baseUrl=$baseUrl;
$this->_basePath=$basePath;
}
Constructor.
public string getBasePath() |
{return} | string | the file path to the theme folder |
public string getBaseUrl() |
{return} | string | the relative URL to the theme folder (without ending slash) |
public string getLayoutFile(CController $controller, string $layoutName) |
$controller | CController | the controller |
$layoutName | string | the layout name |
{return} | string | the layout file path. False if the file does not exist. |
Source Code: framework/web/CTheme.php#113 (
show)
public function getLayoutFile($controller,$layoutName)
{
$moduleViewPath=$basePath=$this->getViewPath();
$module=$controller->getModule();
if(empty($layoutName))
{
while($module!==null)
{
if($module->layout===false)
return false;
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);
}
Finds the layout file for the specified controller's layout.
public string getName() |
{return} | string | theme name |
public string getSkinPath() |
{return} | string | the path for widget skins. Defaults to 'ThemeRoot/views/skins'. |
public string getSystemViewPath() |
{return} | string | the path for system views. Defaults to 'ThemeRoot/views/system'. |
public string getViewFile(CController $controller, string $viewName) |
$controller | CController | the controller |
$viewName | string | the view name |
{return} | string | the view file path. False if the file does not exist. |
Source Code: framework/web/CTheme.php#99 (
show)
public function getViewFile($controller,$viewName)
{
$moduleViewPath=$this->getViewPath();
if(($module=$controller->getModule())!==null)
$moduleViewPath.='/'.$module->getId();
return $controller->resolveViewFile($viewName,$this->getViewPath().'/'.$controller->getUniqueId(),$this->getViewPath(),$moduleViewPath);
}
Finds the view file for the specified controller's view.
public string getViewPath() |
{return} | string | the path for controller views. Defaults to 'ThemeRoot/views'. |