CThemeManager
| 包 | system.web |
|---|---|
| 继承 | class CThemeManager » CApplicationComponent » CComponent |
| 实现 | IApplicationComponent |
| 可用自 | 1.0 |
| 版本 | $Id$ |
CThemeManager manages the themes for the Web application.
A theme is a collection of view/layout files and resource files (e.g. css, image, js files). When a theme is active, CController will look for the specified view/layout under the theme folder first. The corresponding view/layout files will be used if the theme provides them. Otherwise, the default view/layout files will be used.
By default, each theme is organized as a directory whose name is the theme name. All themes are located under the "WebRootPath/themes" directory.
To activate a theme, set the theme property to be the name of that theme.
Since a self-contained theme often contains resource files that are made Web accessible, please make sure the view/layout files are protected from Web access.
A theme is a collection of view/layout files and resource files (e.g. css, image, js files). When a theme is active, CController will look for the specified view/layout under the theme folder first. The corresponding view/layout files will be used if the theme provides them. Otherwise, the default view/layout files will be used.
By default, each theme is organized as a directory whose name is the theme name. All themes are located under the "WebRootPath/themes" directory.
To activate a theme, set the theme property to be the name of that theme.
Since a self-contained theme often contains resource files that are made Web accessible, please make sure the view/layout files are protected from Web access.
公共属性
| 属性 | 类型 | 描述 | 被定义在 |
|---|---|---|---|
| basePath | string | the base path for all themes. | CThemeManager |
| baseUrl | string | the base URL for all themes. | CThemeManager |
| behaviors | array | the behaviors that should be attached to this component. | CApplicationComponent |
| isInitialized | boolean | whether this application component has been initialized (i. | CApplicationComponent |
| themeClass | string | the name of the theme class for representing a theme. | CThemeManager |
| themeNames | array | list of available theme names | CThemeManager |
公共方法
| 方法 | 描述 | 被定义在 |
|---|---|---|
| __call() | Calls the named method which is not a class method. | CComponent |
| __get() | Returns a property value, an event handler list or a behavior based on its name. | CComponent |
| __isset() | Checks if a property value is null. | CComponent |
| __set() | Sets value of a component property. | CComponent |
| __unset() | Sets a component property to be null. | CComponent |
| asa() | Returns the named behavior object. | CComponent |
| attachBehavior() | Attaches a behavior to this component. | CComponent |
| attachBehaviors() | Attaches a list of behaviors to the component. | CComponent |
| attachEventHandler() | Attaches an event handler to an event. | CComponent |
| canGetProperty() | Determines whether a property can be read. | CComponent |
| canSetProperty() | Determines whether a property can be set. | CComponent |
| detachBehavior() | Detaches a behavior from the component. | CComponent |
| detachBehaviors() | Detaches all behaviors from the component. | CComponent |
| detachEventHandler() | Detaches an existing event handler. | CComponent |
| disableBehavior() | Disables an attached behavior. | CComponent |
| disableBehaviors() | Disables all behaviors attached to this component. | CComponent |
| enableBehavior() | Enables an attached behavior. | CComponent |
| enableBehaviors() | Enables all behaviors attached to this component. | CComponent |
| getBasePath() | CThemeManager | |
| getBaseUrl() | CThemeManager | |
| getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
| getIsInitialized() | CApplicationComponent | |
| getTheme() | CThemeManager | |
| getThemeNames() | CThemeManager | |
| hasEvent() | Determines whether an event is defined. | CComponent |
| hasEventHandler() | Checks whether the named event has attached handlers. | CComponent |
| hasProperty() | Determines whether a property is defined. | CComponent |
| init() | Initializes the application component. | CApplicationComponent |
| raiseEvent() | Raises an event. | CComponent |
| setBasePath() | CThemeManager | |
| setBaseUrl() | CThemeManager |
属性详情
basePath
属性
the base path for all themes. Defaults to "WebRootPath/themes".
baseUrl
属性
the base URL for all themes. Defaults to "/WebRoot/themes".
themeClass
属性
public string $themeClass;
the name of the theme class for representing a theme. Defaults to CTheme. This can also be a class name in dot syntax.
themeNames
属性
只读
public array getThemeNames()
list of available theme names
方法详情
getBasePath()
方法
|
public string getBasePath()
| ||
| {return} | string | the base path for all themes. Defaults to "WebRootPath/themes". |
getBaseUrl()
方法
|
public string getBaseUrl()
| ||
| {return} | string | the base URL for all themes. Defaults to "/WebRoot/themes". |
getTheme()
方法
|
public CTheme getTheme(string $name)
| ||
| $name | string | name of the theme to be retrieved |
| {return} | CTheme | the theme retrieved. Null if the theme does not exist. |
getThemeNames()
方法
|
public array getThemeNames()
| ||
| {return} | array | list of available theme names |
setBasePath()
方法
|
public void setBasePath(string $value)
| ||
| $value | string | the base path for all themes. |
setBaseUrl()
方法
|
public void setBaseUrl(string $value)
| ||
| $value | string | the base URL for all themes. |