Smarty view renderer Allows you to use Smarty templates in Yii
#4
Posted 31 December 2009 - 05:47 AM
Why do you want to use Yii::app?
Fansy Gong
You can check it out from SVN: http://code.google.c...rtyViewRenderer
#5
Posted 31 December 2009 - 07:45 AM
#6
Posted 28 January 2010 - 08:27 AM
<?= CHtml::beginForm(); ?> <?= CHtml::endForm(); ?>
<? $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=> Yii::t('site', 'Login'), 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
array('label'=> Yii::t('site', 'Logout'), 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
),
)); ?>just replacing 'vars' is not enough to be smarty renderer
#7
Posted 28 January 2010 - 08:59 AM
#8
Posted 09 February 2010 - 04:09 PM
I dont get any documentation about how to use smarty in yii..
and I get error when install smarty on yii.
I have following this instruction
* Copy latest version of Smarty (libs contents) to vendors/Smarty/. * * Add the following to your config file 'components' section: * * 'viewRenderer'=>array( * 'class'=>'application.extensions.Smarty.CSmartyViewRenderer', * 'fileExtension' => '.tpl', * //'pluginsDir' => 'application.smartyPlugins', * //'configDir' => 'application.smartyConfig', * ),
but there are still error,
I copy that above into frameworks folder not into myblog's folder.
and CSmartyViewRenderer.php copied into myblog's folder which is my application folder
so the directory structure in my yii project is
./ + myblog + framework + CHANGELOG + LICENSE + README
the error is:
Description require_once(Smarty/Smarty.class.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory Source File /mnt/win_d/www/website/latihan/yii/blogformatika/protected/extensions/Smarty/CSmartyViewRenderer.php(35)
please help me...
thanks
------
DanDinDun
#9
Posted 10 February 2010 - 04:55 AM
#10
Posted 10 February 2010 - 05:37 AM
samdark, on 10 February 2010 - 04:55 AM, said:
oh ... I guess, vendors directory on framework..... because defaultly. when I have run yii console, there are no vendors directory...
oh ya sir.. so how to use smarty & yii widget?
can you give me an example sir?
I very newbea in yii.. and I can't understand the yii documentation...
thanks..
------
DanDinDun
#11
Posted 10 February 2010 - 05:41 AM
#12
Posted 10 February 2010 - 05:49 AM
samdark, on 10 February 2010 - 05:41 AM, said:
oh yes... thanks you sir, the link that mentioned above post are miss but, this link now is works...
thank you very much..much sir :-)
------
DanDinDun
#13
Posted 13 July 2010 - 08:25 AM
I was reading the artycle about Smarty into Yii, and I try to download de extention, but the download link no longer exists. I try to SVN but there is nothing yet. Some one know how can I download it?
Sorry for my english(I'm Brazilian).
#15
Posted 26 October 2010 - 06:32 PM
i have follow the instruction
and replace
\www\testdrive\protected\views\user\create.php
with
\www\testdrive\protected\views\user\create.tpl
all things right i think
what i need now how to assign variable to this .tpl
link $smarty->assign
#17
Posted 31 October 2010 - 09:00 AM
class MyController extends CController {
function actionIndex(){
$this->render('template', array(
'variable' => 'value'
));
}
}
#18
Posted 25 December 2010 - 08:49 AM
I got this error, could you tell me what should i do?
PHP Error
Description
include(Smarty_Internal_Data.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
Source File
/var/www/yii/framework/YiiBase.php(395)
00383: * @return boolean whether the class has been loaded successfully
00384: */
00385: public static function autoload($className)
00386: {
00387: // use include so that the error PHP file may appear
00388: if(isset(self::$_coreClasses[$className]))
00389: include(YII_PATH.self::$_coreClasses[$className]);
00390: else if(isset(self::$classMap[$className]))
00391: include(self::$classMap[$className]);
00392: else
00393: {
00394: if(strpos($className,'\\')===false)
00395: include($className.'.php');
00396: else // class name with namespace in PHP 5.3
00397: {
00398: $namespace=str_replace('\\','.',ltrim($className,'\\'));
00399: if(($path=self::getPathOfAlias($namespace))!==false)
00400: include($path.'.php');
00401: else
00402: return false;
00403: }
00404: return class_exists($className,false) || interface_exists($className,false);
00405: }
00406: return true;
00407: }
BTW, could you update your readme page and make it more clear please? It is very confused.
Thanks
Changyong
#19
Posted 25 December 2010 - 05:26 PM
#20
Posted 04 January 2011 - 04:13 PM
Changyong, on 25 December 2010 - 08:49 AM, said:
Same Problem here, I use the latest release of Smarty (3.0.6).
The Problem seems to be that the Yii autoloader ist called before the Smarty autoloader and fails because Smarty Class Files are not in Yii style.

Help














