How to set defaultView?

I’m almost sure that I’ve read that this can be done and how in some old forum post but now can’t find it anymore…

Anyway: how do I set the defaultView property from my config file?

thanks.

bye,

Giovanni.

Since CViewAction is not an application component, I doubt you can set defaultView in your config file.

hi and thanks for your answer…

i’ve thought it was as you said but hoped that there was a workaround… Cause else you have to keep “index” as the default view name.

i’ve changed the topic title :wink: …so… Which is the best way to set it? From the main index file?

thanks.

bye,

Giovanni.

As Yii currently does not do any magic autorendering (and fortunately shows no interests to do so), you still have to call CController::render in which you can always name your desired view file.

Yep, I know… but I saw that you can define the default theme and the default controller from config so I was wondering if it is possible for the default view too.

Anyway this is not vital for the reason you told; I was thinking for example of a case where you want to have your url translated to your local language so instead of having "site/index" you could have "sito/indice" … but it is also true that you can do this using the urlManager…

Searching the code it also seems that the defaultView property is never used ::) …but anyway, not a priority as I said… more a curiosity.

thanks

bye,

Giovanni.

I am trying to set the default view for CViewAction and can’t seem to get this to work. I was looking at the example to include static pages using yii and got that working. So, for example I have a “pages” folder under views/site location. Inside this “pages” folder I have an aboutus.php file. This scenario works. However, I wanted to put a default view on the action in the SiteController so if a user wanted to end up at the root of the pages I could display an index page or run a function or whatever. I tried the following:

 'page'=>array(


     'class'=>'CViewAction',


 'defaultView'=>'blankpage',


  ),

No matter what I always get a page not found. blankpage.php is also in my pages folder. I’m new to yii so I’m probably doing something wrong. Any suggestions?