Hi, I want to create my users top, I order by points…
I’m wondering just what is the best way to go…
I have inside laoyout directory, a view _sideBlock
I need to use it, cause the widget will be side column block,
When I extend CWidget and do ->render
I get a message that the
How can I give it the path?
The widget is inside components… the view is inside my theme as I described above
If we will look at the blog example, one can notice that the widget’s views are right near in the components…
But why copy paste? there isn’t a way to give it the path ?
I think this may help you out.
It returns the view path (application\components\views), I need to take the view from the current theme…
Just like in controller I use
Need the same from inside CWidget via it’s render, the documentation not helping
If listen to documentation the view is searched in themes/basic/views/Foo/xyz.php
Where Foo is CWidget name… and ‘xyz’ is the view
But as I described I need it to be tacken from the global theme, layout/_sideblock.php
This is the best I got , very ugly… but don’t found another solution
$this->renderFile(Yii::app()->theme->basePath . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'layouts' . DIRECTORY_SEPARATOR . '_sideBlock.php', array(...
If you define different themes, at least you should be able to get the corresponding view path "ThemeID/views/ClassName" by setting the checkTheme parameter.
I suppose you have a good reason not to include the widget itself in a sublayout like the Gii generated column1.php.
Sorry for not being able to help. I still have to find out more about best practice implementing modular layouts.