system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.i18n system.i18n.gettext system.logging system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers

CViewRenderer

system.web.renderers
继承 abstract class CViewRenderer » CApplicationComponent » CComponent
实现 IApplicationComponent, IViewRenderer
子类 CPradoViewRenderer
可用自 1.0
版本 $Id$
CViewRenderer is the base class for view renderer classes.

A view renderer is an application component that renders views written in a customized syntax.

Once installing a view renderer as a 'viewRenderer' application component, the normal view rendering process will be intercepted by the renderer. The renderer will first parse the source view file and then render the the resulting view file.

Parsing results are saved as temporary files that may be stored under the application runtime directory or together with the source view file.

公共属性

隐藏继承的属性

属性类型描述被定义在
behaviors array the behaviors that should be attached to this component. CApplicationComponent
fileExtension string the extension name of the view file. CViewRenderer
filePermission integer the chmod permission for temporary directories and files generated during parsing. CViewRenderer
isInitialized boolean whether this application component has been initialized (i. CApplicationComponent
useRuntimePath boolean whether to store the parsing results in the application's runtime directory. CViewRenderer

公共方法

隐藏继承的方法

方法描述被定义在
__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
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
getIsInitialized() CApplicationComponent
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
renderFile() Renders a view file. CViewRenderer

受保护的方法

隐藏继承的方法

方法描述被定义在
generateViewFile() Parses the source view file and saves the results as another file. CViewRenderer
getViewFile() Generates the resulting view file path. CViewRenderer

属性详情

fileExtension 属性 (自版本 v1.0.9 可用)
public string $fileExtension;

the extension name of the view file. Defaults to '.php'.

filePermission 属性
public integer $filePermission;

the chmod permission for temporary directories and files generated during parsing. Defaults to 0755 (owner rwx, group rx and others rx).

useRuntimePath 属性
public boolean $useRuntimePath;

whether to store the parsing results in the application's runtime directory. Defaults to true. If false, the parsing results will be saved as files under the same directory as the source view files and the file names will be the source file names appended with letter 'c'.

方法详情

generateViewFile() 方法
abstract protected void generateViewFile(string $sourceFile, string $viewFile)
$sourceFile string the source view file path
$viewFile string the resulting view file path

Parses the source view file and saves the results as another file.

getViewFile() 方法
protected string getViewFile(string $file)
$file string source view file path
{return} string resulting view file path

Generates the resulting view file path.

renderFile() 方法
public mixed renderFile(CBaseController $context, string $sourceFile, mixed $data, boolean $return)
$context CBaseController the controller or widget who is rendering the view file.
$sourceFile string the view file path
$data mixed the data to be passed to the view
$return boolean whether the rendering result should be returned
{return} mixed the rendering result, or null if the rendering result is not needed.

Renders a view file. This method is required by IViewRenderer.