Themes from PRADO

Hello

I have been programming with PRADO for about two years already and decided to migrate to YII. My question regards the use of themes in YII.

When using prado I used to have all my images and css classes in the themes folder and my HTML forms and "views" under protected. Whenever I needed to change my html structure or my forms I just had to change the desired file and the theme will always mount itself on top of it…but in YII I see that I also have to place my views files into the themes folder as well.

Why do I have to duplicate my view files in the theme folder? doesnt it means that I have to modify all these files in the case i wish to make any changes to my html structure? what if i have 200 themes? does it means that I have modify 200 html structures as well?

Maybe i am missunderstanding the themes engine of YII but, is there is way that my themes folder could read all the views from a common location?

thanks

I haven’t used Prado but from what you said, it seems that in prado themes comprise of css and images.

However, in Yii, themes comprise of css, images, views etc. (That has always been my my opinion of how a theme should be).

But there is good news for you.

You can mimic the behavior you used in prado. Put your view files in protected/views and your images and css in themes/themeName.

when a theme is set, eg your theme is named red,

use this to get the url of the theme


Yii::app()->theme->baseUrl

It will return themes/red

so you will be able to reference your css/images like Yii::app()->theme->baseUrl.’/images/imageName.extension’;

When a theme is set, as long as you do not put your view files in themes/themeName/views then the view files will be loaded from protected/views.

I hope this clear things up for you.

I think that sentence of yours is they key for this issue…then if i dont user a view folder within themes, my views will always be takken from protected…

I am sure there is a reason for "duplicating" the views within themes but, comming from a PRADO backgound, it is easier for me to simplify things at this point

thank you very much for your help.

You are welcome.

The reason for themes having their own view files is so you can have themes with different markup, not just css and images.

Also in Yii you don’t have the skins as you are using in Prado…

You should check this page to introduce into themming and skins in Yii

http://www.yiiframework.com/doc/guide/topics.theming