phpviewrenderer PHP view renderer class

  1. Requirements
  2. Usage
  3. Resources

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.

Requirements

e.g. Yii 1.1.12 or above

Usage

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 :)

Enjoy!

Resources

0 0
3 followers
236 downloads
Yii Version: Unknown
License: BSD-2-Clause
Category: User Interface
Developed by: djvibegga
Created on: Nov 18, 2013
Last updated: 10 years ago

Downloads

show all

Related Extensions