I saw a lot of questions regarding the link to themed resources in CakePHP, and none of them solves my problem, and the last post was in 2012, so I thought that I would post my question there.
I applied themes in my CakePHP 2.2.4 application. My theme called "default" (previously called "default" up to 1 minute ago) is in app/View/Themed/default (previously the theme name also had a corresponding D header for the folder name).
My css file is in app/View/Themed/default/webroot/css/style.css , which I call in app/View/Themed/default/Layouts/default.ctp with the following code
Layout Default.ctp
echo $this->Html->css('style');
(I tried to use the capital W for webroot "just in case", but it is not surprising that this did not work)
I have included this link in my AppController to establish which theme I am using. All view files point to the correct topic, but the problem is right now with the stylesheet (I still need to interact with other resources such as js or image files).
Appcontroller
class AppController extends Controller { public $theme = 'default';
I read the following questions and none of the “solutions” worked. Most of the solutions were spell checking / capitalization, checking folder permissions, checking my .htaccess file, etc. Still nothing. And new ideas?
.htaccess
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule>
Folder permissions for web pages and css folders of theme 755.
Here are some resources that I used with no luck.
http://book.cakephp.org/2.0/en/views/themes.html
CakePHP Theme Resource Error
Unable to retrieve css and image files in cakephp websites web troll folder
https://groups.google.com/forum/#!topic/cake-php/xaRAugMoNSc
CakePHP 2.x theme not working
https://groups.google.com/forum/#!topic/cake-php/siYVWchUb1g
UPDATE: using $this->Html->image('image.jpg') , correctly displays a specific image located in View/Themed/Default/webroot/img/image.jpg . However, using $this->Html->css('style') trying to pull the stylesheet from app/webroot/css/style.css , not from app/View/Themed/default/webroot/css/style.css . I also had to change the theme name and the folder name of my theme to "Default" with an uppercase letter D to get the correct image. The stylesheet is still incorrectly linked. If I go directly to my theme stylesheet in the browser, a blank page will appear. If I go to a stylesheet that does not exist in my theme folder, then I get the correct error message. However, viewing the source of my theme stylesheet (the one that exists) shows a blank page.