CPradoViewRenderer
| 包 | system.web.renderers |
|---|---|
| 继承 | class CPradoViewRenderer » CViewRenderer » CApplicationComponent » CComponent |
| 实现 | IViewRenderer, IApplicationComponent |
| 可用自 | 1.0 |
| 版本 | $Id$ |
CPradoViewRenderer implements a view renderer that allows users to use a template syntax similar to PRADO templates.
To use CPradoViewRenderer, configure it as an application component named "viewRenderer" in the application configuration:
CPradoViewRenderer allows you to write view files with the following syntax:
To use CPradoViewRenderer, configure it as an application component named "viewRenderer" in the application configuration:
array(
'components'=>array(
......
'viewRenderer'=>array(
'class'=>'CPradoViewRenderer',
),
),
)
CPradoViewRenderer allows you to write view files with the following syntax:
// PHP tags:
<%= expression %>
// <?php echo expression ?>
<% statement %>
// <?php statement ?>
// component tags:
<com:WigetClass name1="value1" name2='value2' name3={value3} >
// <?php $this->beginWidget('WigetClass',
// array('name1'=>"value1", 'name2'=>'value2', 'name3'=>value3)); ?>
</com:WigetClass >
// <?php $this->endWidget('WigetClass'); ?>
<com:WigetClass name1="value1" name2='value2' name3={value3} />
// <?php $this->widget('WigetClass',
// array('name1'=>"value1", 'name2'=>'value2', 'name3'=>value3)); ?>
// cache tags:
<cache:fragmentID name1="value1" name2='value2' name3={value3} >
// <?php if($this->beginCache('fragmentID',
// array('name1'=>"value1", 'name2'=>'value2', 'name3'=>value3))): ?>
</cache:fragmentID >
// <?php $this->endCache('fragmentID'); endif; ?>
// clip tags:
<clip:clipID >
// <?php $this->beginClip('clipID'); ?>
</clip:clipID >
// <?php $this->endClip('clipID'); ?>
// comment tags:
<!--- comments --->
// the whole tag will be stripped off
公共属性
| 属性 | 类型 | 描述 | 被定义在 |
|---|---|---|---|
| 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. | CPradoViewRenderer |
| getViewFile() | Generates the resulting view file path. | CViewRenderer |
方法详情
generateViewFile()
方法
|
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. This method is required by the parent class.