Yii Framework Forum: Smarty view renderer - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Smarty view renderer Allows you to use Smarty templates in Yii Rate Topic: -----

#21 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,425
  • Joined: 17-January 09
  • Location:Russia

Posted 04 January 2011 - 04:41 PM

Try extension from SVN.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#22 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 482
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 04 January 2011 - 05:44 PM

Works fine, thanks!
0

#23 User is offline   AverQuen 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 10-April 11

Posted 10 April 2011 - 03:19 AM

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.
0

#24 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,425
  • Joined: 17-January 09
  • Location:Russia

Posted 10 April 2011 - 05:45 AM

Yes, archives got messed a bit with latest release. Will fix it.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#25 User is offline   dans 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 21-October 10

Posted 01 June 2011 - 09:13 AM

Hey, why would you use Smarty templates over the views that Yii provides?
Not trying to criticize, maybe I'm missing something.. Just curious..??:)
0

#26 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,425
  • Joined: 17-January 09
  • Location:Russia

Posted 01 June 2011 - 09:37 AM

That's just because of personal preference, I guess.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#27 User is offline   spier 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 19-June 11

Posted 19 June 2011 - 01:40 PM

View Postdans, on 01 June 2011 - 09:13 AM, said:

Hey, why would you use Smarty templates over the views that Yii provides?
Not trying to criticize, maybe I'm missing something.. Just curious..??:)


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
0

#28 User is offline   Petroga 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 21-June 11

Posted 21 June 2011 - 09:27 AM

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

Quote

Привет,

я подключил расширение и попытался сделать следующее:

создал файл main.tpl
создал файл auth.tpl, расширил от main.tpl
создал файл login_page.tpl, расширил от auth.tpl

Когда перехожу на страницу login_page то мне выводится main.tpl.
Полез в compiled, там два файла, первый собственно тот что выводится а второй по сути нужный мне файл который по какой то причине не отображается.
В чём может быть проблема?

Использую Yii 1.1.7 и Smarty 3.0.8.

Спасибо.

This post has been edited by Petroga: 21 June 2011 - 09:50 AM

0

#29 User is offline   adyd 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-December 11

Posted 20 December 2011 - 09:15 AM

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
0

#30 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 482
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 20 December 2011 - 04:49 PM

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.
0

#31 User is offline   Huynh Van Chung 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 19-February 12

Posted 01 March 2012 - 03:06 AM

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.
0

#32 User is offline   hadi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 10-February 12

Posted 30 July 2012 - 09:32 AM

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.
0

#33 User is offline   vinu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 09-November 11

Posted 10 September 2012 - 02:07 AM

View Posthadi, on 30 July 2012 - 09:32 AM, said:

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..?
0

#34 User is offline   AndreiCurelaru 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 11-November 12
  • Location:France

Posted 26 November 2012 - 09:31 AM

Hi,
After following the github steps, i still got that :

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



even tried to change my extensions folder structure to have yiiext/renderers inside, but nothing works.

What am i missing out ?
How dit it worked for you ?

$ -help
Les Tags pour organiser le Forum FrenchYii : LINK
@AndreiCurelaru
0

#35 User is offline   CircleDev 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 21-January 13

  Posted 21 January 2013 - 10:56 PM

@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
0

#36 User is offline   Lence 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 02-February 13

Posted 05 February 2013 - 04:59 AM

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. ;)
0

#37 User is offline   Adrian Noble 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-December 11

Posted 01 March 2013 - 01:11 PM

View PostAndreiCurelaru, on 26 November 2012 - 09:31 AM, said:

Hi,
After following the github steps, i still got that :

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



even tried to change my extensions folder structure to have yiiext/renderers inside, but nothing works.

What am i missing out ?
How dit it worked for you ?

$ -help


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

Thanks,

Adrian
0

#38 User is offline   dark4ce 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 04-June 13

Posted 04 June 2013 - 11:13 AM

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.
0

#39 User is offline   Edjimucator 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 01-March 13

Posted 16 June 2013 - 01:00 PM

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.
0

#40 User is offline   ryunakai 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 06-August 13

Posted 06 August 2013 - 03:38 AM

Hi,
Thank you for this useful extention.

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));
}


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

Thank you.
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users