dckurushin
(Diavolonok)
September 24, 2011, 4:11pm
1
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 ?
tri
(tri - Tommy Riboe)
September 24, 2011, 4:29pm
2
I think this may help you out.
(not tested)
/Tommy
dckurushin
(Diavolonok)
September 24, 2011, 5:25pm
3
It returns the view path (application\components\views), I need to take the view from the current theme…
Just like in controller I use
$this->render('//layout/_sideBlock');
Need the same from inside CWidget via it’s render, the documentation not helping
dckurushin
(Diavolonok)
September 24, 2011, 5:29pm
4
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
dckurushin
(Diavolonok)
September 24, 2011, 5:49pm
5
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(...
tri
(tri - Tommy Riboe)
September 24, 2011, 6:51pm
6
dckurushin:
It returns the view path (application\components\views), I need to take the view from the current theme…
Just like in controller I use
$this->render('//layout/_sideBlock');
Need the same from inside CWidget via it’s render, the documentation not helping
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.
/Tommy