Fork me on GitHub

Шаблонизатор Smarty для Yii

Данное расширение позволяет использовать Smarty версии 3 в приложениях Yii.

Полезные ссылки

Требования

  • Yii 1.0 и выше
  • Smarty 3.0.6 и выше

Установка

  • Распаковать в protected/extensions.
  • Скачать и распаковать содержимое директории libs в protected/vendors/Smarty.
  • Добавить в конфигурацю в секцию 'components':
'viewRenderer'=>array(
  'class'=>'application.extensions.yiiext.renderers.smarty.ESmartyViewRenderer',
    'fileExtension' => '.tpl',
    //'pluginsDir' => 'application.smartyPlugins',
    //'configDir' => 'application.smartyConfig',
    //'prefilters' => array(array('MyClass','filterMethod')),
    //'postfilters' => array(),
    //'config'=>array(
    //    'force_compile' => YII_DEBUG,
    //   ... any Smarty object parameter
),

There are some more options on configuring Smarty properties now. Will add documentation soon.

Использование

  • Документация Smarty.
  • Свойства текущего контроллера доступны как {$this->pageTitle}.
  • Свойства Yii доступны как {$Yii->theme->baseUrl}.
  • Использованную память можно вывести как {$MEMORY}, затраченное время как {$TIME}.

Changelog

1.0.2

  • Added ability to define pre- and postfilters in yii config (grigori) Filters defined with a class-method array callback syntax are lazy-loaded by yii autoloader for compilation only.

1.0.1

  • Smarty 3.1 compatibility (Sam Dark, cebe)
  • Fixed a problem with nested template rendering and Smarty 3.1.x (cebe)
  • Tested compatibility with Smarty 3.0.6-9 and Smarty 3.1.0-5 ci (cebe)

1.0.0

  • changed autoload handling to work also when Yii autoloader has been modified (cebe)
  • ensure Smarty does not use SMARTY_SPL_AUTOLOAD (cebe)

0.9.9

  • Added possiblity to configure smarty properties (CAUTION: behavior of $filePermission changed) (cebe)
  • Fixed issue with rendering Widgets within a template (cebe)

0.9.8

  • Fixed renderFile method (Sam Dark)
  • Fixed bug with autoload Smarty 3 files in *nix (maksimgrib)

0.9.7

  • Code cleanup and minor fixes.

0.9.6

  • Changed translation category to 'yiiext'.
  • New naming conventions.
  • readme_ru.
  • Added $Yii variable.

0.9.5

  • YiiExt naming conventions changed, see readme.
  • Smarty 3 comatibility.
  • t and link plugin functions.

0.9

  • Initial public release (Sam Dark)

This extension allows you to use Smarty 3 templates in Yii.

Documentation

Downloads (Tags)

Resources