I’m new to the Yii Framework (all web development subjects for that matter) and I’m working through the Packt Publishing’s Beginning Yii.
My directory structre is something like:
/protected
/runtime
/www
All has been defined accordingly in main.php based on the course video and site is working just fine.
Through the course, there is a task regarding themes to be accomplished. Instructions are simple enough:
copy the www folder from the course package to the related folder (in my case, /webroot/www/themes
themes folder includes:
classic
../views
../../layouts
../../site
../../system
photoGal
../css
../../screen.css
../images
../../bg.png
../views
../../layouts
../../site
../../system
define the layout name in the protected/config/main.php
I have done as I asked, but theme did not seemed to work at all. I decided to tinker with the theme provided CSS a bit, but it does not seem to take any effect on the rendered webpage. I decided to go deep and I found the www/main.css file. When I change this, it does take effect. But when I change the www/themes/photoGal/css/screen.css file, it has no effect at all.
When I try to output <?php echo Yii::app()->theme->name ?> on a view, it prints out photoGal, so I think it is not related to the configuration.
Oh, silly me. I somehow figured that Yii will automatically look to the themes folder for css files even without a layout file in it. I don’t know where did I get that idea. I copied the layout files to the theme folder and modified as you described, now it works like a charm. Thank you very very much!
this actually did not work for me. It did indeed apply the screen.css style from the theme, but all the information from the original screen.css was, as can be excpected not applied so I did not get the same result as in the video. The solution I found was to leave the original reference to the main screen.css and add a line for the theme’s screen.css