This class allows native php view rendering. Yii has opportunity of rendering php views, but that code doesn't incapsulated in some renderer class. So, you can't easy render a view when a console application is runned. This extension solves that problem.
e.g. Yii 1.1.12 or above
First, define a viewRenderer component in an application configuration:
... 'components' => array( ... 'viewRenderer' => array( 'class' => 'CPhpViewRenderer' ), ... ), ...
Second, you can use directly the renderer component for rendering views (usually needed for console applications):
... $context = $renderer = Yii::app()->getComponent('viewRenderer'); $viewData = array('param1' => 'value1', 'param2' => 'value2'); $content = $renderer->renderFile($context, 'absolute/path/to/view/file', $viewData, true); ...
Third, CController::render(), CWidget::render() methods will work same way as in the framework :)
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.