Commit abff8079 by samdark

a lot of changes

parent c2306df8
<?php
/**
* Dwoo renderer for Yii
*
* Copy latest version of Dwoo (dwoo-x.x.x.tar\dwoo\) to vendors/Dwoo/.
*
* Add the following to your config file 'components' section:
*
* 'viewRenderer'=>array(
* 'class'=>'application.extensions.Dwoo.CDwooViewRenderer',
* 'fileExtension' => '.tpl',
* //'pluginsDir' => 'application.dwooPlugins',
* ),
* Dwoo view renderer
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @link http://www.yiiframework.com/
* @link http://code.google.com/p/yiiext/
* @link http://dwoo.org/
*
* @version 0.9
* @version 0.9.1
*/
class CDwooViewRenderer extends CApplicationComponent implements IViewRenderer {
class EDwooViewRenderer extends CApplicationComponent implements IViewRenderer {
public $fileExtension='.tpl';
public $filePermission=0755;
public $pluginsDir = null;
......@@ -84,10 +74,13 @@ class CDwooViewRenderer extends CApplicationComponent implements IViewRenderer {
public function renderFile($context,$sourceFile,$data,$return) {
// current controller properties will be accessible as {this.property}
$data['this'] = $context;
$data['Yii'] = Yii::app();
$data["TIME"] = sprintf('%0.5f',Yii::getLogger()->getExecutionTime());
$data["MEMORY"] = round(Yii::getLogger()->getMemoryUsage()/(1024*1024),2)." MB";
// check if view file exists
if(!is_file($sourceFile) || ($file=realpath($sourceFile))===false)
throw new CException(Yii::t('yii','View file "{file}" does not exist.', array('{file}'=>$sourceFile)));
throw new CException(Yii::t('yiiext','View file "{file}" does not exist.', array('{file}'=>$sourceFile)));
//render
return $this->dwoo->get($sourceFile, $data);
......
0.9.1
[*] Changed translation category to 'yiiext'.
[*] New naming conventions.
[+] readme_ru.
[+] Added Yii varialbe.
[+] Added TIME and MEMORY variables.
0.9
[+] Initial public release.
\ No newline at end of file
CDwooViewRenderer
=================
Dwoo view renderer
==================
This extension allows you to use [Dwoo](http://dwoo.org/) templates in Yii.
###Resources
* [SVN](http://code.google.com/p/yiiext/source/browse/#svn/trunk/app/extensions/CDwooViewRenderer)
* [SVN](http://code.google.com/p/yiiext/source/browse/trunk/app/extensions#extensions/yiiext/renderers/dwoo)
* [Dwoo](http://dwoo.org/)
* [Discuss](http://www.yiiframework.com/forum/index.php?/topic/4965-dwoo-view-renderer/)
* [Report a bug](http://code.google.com/p/yiiext/issues/list)
......@@ -19,7 +19,7 @@ This extension allows you to use [Dwoo](http://dwoo.org/) templates in Yii.
~~~
[php]
'viewRenderer'=>array(
'class'=>'application.extensions.CDwooViewRenderer.CDwooViewRenderer',
'class'=>'ext.yiiext.renderers.dwoo.EDwooViewRenderer',
'fileExtension' => '.tpl',
//'pluginsDir' => 'application.dwooPlugins',
),
......@@ -27,4 +27,6 @@ This extension allows you to use [Dwoo](http://dwoo.org/) templates in Yii.
###Usage
* [Dwoo syntax](http://wiki.dwoo.org/index.php/Syntax).
* Current controller properties are accessible via {$this->pageTitle}.
\ No newline at end of file
* Current controller properties are accessible via {$this->pageTitle}.
* Yii properties are available as follows: {$Yii->theme->baseUrl}.
* Used memory is stored in {$MEMORY}, used time is in {$TIME}.
\ No newline at end of file
Шаблонизатор Dwoo для Yii
=========================
Данное расширение позволяет использовать [Dwoo](http://dwoo.org/) в шаблонах Yii.
###Полезные ссылки
* [SVN](http://code.google.com/p/yiiext/source/browse/trunk/app/extensions#extensions/yiiext/renderers/dwoo)
* [Dwoo](http://dwoo.org/)
* [Обсуждение](http://yiiframework.ru/forum/viewtopic.php?f=9&t=245)
* [Соощить об ошибке](http://code.google.com/p/yiiext/issues/list)
###Требования
* Yii 1.0 и выше
###Установка
* Распаковать в `protected/extensions`.
* [Скачать](http://dwoo.org/download) и распаковать `dwoo-x.x.x.tar\dwoo\` в `protected/vendors/Dwoo`.
* Добавить в конфигурацю в секцию 'components':
~~~
[php]
'viewRenderer'=>array(
'class'=>'ext.yiiext.renderers.dwoo.EDwooViewRenderer',
'fileExtension' => '.tpl',
//'pluginsDir' => 'application.dwooPlugins',
),
~~~
###Использование
* [Синтаксис Dwoo](http://wiki.dwoo.org/index.php/Syntax).
* Свойства текущего контроллера доступны как {$this->pageTitle}.
* Свойства Yii доступны как {$Yii->theme->baseUrl}.
* Использованную память можно вывести как {$MEMORY}, затраченное время как {$TIME}.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment