Smarty view renderer

Try extension from SVN.

Works fine, thanks!

Unfortunately, the archive that is downloaded is doubly nested and doesn’t work out of the box. You’ll have to carefully trace the error you get back to make sure that the ESmartyViewRenderer is at the right level.

Yes, archives got messed a bit with latest release. Will fix it.

Hey, why would you use Smarty templates over the views that Yii provides?

Not trying to criticize, maybe I’m missing something… Just curious…??:)

That’s just because of personal preference, I guess.

Like everything it is a preference… I typically use Smarty because it allows web designers to easily modify the HTML without letting them break PHP, and allow the Code not to have to touch the HTML. I have found web designers are able to do what they need to do with Smarty and they have an easier time learning and implementing smarty then PHP. Most of the Smarty functions are designed to make HTML much easier.

… Just my .02

thanks,

Scott

Осознал ошибку, я вызывал метод render(), renderPartial() заработало так как мне нужно.

Is there any documentation related to how to call Smarty templates from the YIIC controller? I have set up the installation as described and haven’t hit any roadblocks. Thanks in advance.

A

You just do it as with normal templates. The only thing you have to do is rename template from *.php to *.tpl so that not yii renders the template but smarty.

Can I use cache function with Smart view renderer?

I use this configurations below:

‘cache_dir’ => ‘./protected/runtime/smarty/cached’,

‘caching’ => true,

‘cache_lifetime’ => 120,

But it don’t work fine. The frontend will not work correctly.

How I can use beginWidget CActiveForm?

I try this:


{$this->beginWidget('CActiveForm', [

        'id'=>'contact-form',

        'enableClientValidation'=>true,

        'clientOptions'=>[

                'validateOnSubmit'=>true

        ]

],true)}

but result display error like that:


Object of class CActiveForm could not be converted to string 

Thanks.

I also got the same problem…any clu…?

Hi,

After following the github steps, i still got that :

[font="Verdana"][size="2"][b]


Alias "application.extensions.yiiext.renderers.smarty.ESmartyViewRenderer" is invalid. Make sure it points to an existing PHP file and the file is readable.

[/b][/size][/font]

[font="Verdana"][size="2"][b]

[/b][/size][/font]

[font="Verdana"][size="2"]even tried to change my extensions folder structure to have yiiext/renderers inside, but nothing works.[/size][/font]

[font="Verdana"] [/font]

[font="Verdana"][size="2"]What am i missing out ?[/size][/font]

[font="Verdana"][size="2"]How dit it worked for you ?[/size][/font]

[font="Verdana"] [/font]

[font="Verdana"][size="2"]$ -help[/size][/font]

@SamDark

Can you explain how to use blocks or is it just not possible with the way Yii builds its pages?

I have been trying (unsuccesfully) to extend the base templates using blocks but they seem to be completely ignored and any content is rendered into the $content var regardless of blockname.

Also do I need to use the $content var?

I am trying to do a fully templated setup like this

inheritance is like this using extends and full Yii alias to parent template

main.tpl<-column2.tpl<-_index.tpl<-index.php

index.php is called via render() from siteController

_index.tpl is called via renderPartial() from index.php

or should I post this as an issue on github?

Thanks for any insight you can offer

Thank you for this extension. To those using yii-debug-toolbar in combination with this extension: make sure you’re using the latest version from GitHub. ;)

Did you ever get a response to this question? I am having the same problem.

Thanks,

Adrian

Hello,

I have tried converting the layouts in my project to smarty templates but it seems that the content of the templates is encoded. Any chance this feature could be added also?

Thank you,

Catalin.

I found this thread quite intriguing. I just recently started using smarty templates and was curious of the workflow involved from controller to View. Am i correct in assuming you still use Yii data providers? Will smarty’s convention of calling a particular piece of data [e.g - $varname.attr] be affected? [More Specifically] will you access data any differently or will the following example suffice? My apologies for poorly described questions I am doing my best to word them correctly; as smarty is still a new concept to me.

Hi,

Thank you for this useful extention.

[s]Can I get 2nd argument of CControler->render() in a Smarty template?

I want to pass a variable "$model" in this controler script to a templete.




public function actionTest()

{

    $model=new MyModel;

    $this->render('myfrom',array('model'=>$model));

}



[/s]

Sorry.

I mistook my templete filename.

I was able to use the variable as {$model} in my templete.

Thank you.