I keep getting this error... Wondering what this means
Error: [MissingControllerException] Controller class CssController could not be found.
any suggestions?
I keep getting this error... Wondering what this means
Error: [MissingControllerException] Controller class CssController could not be found.
any suggestions?
You seem to be either missing the 'css' directory in your webroot or a misconfigured mod_rewrite;
The default CakePHP mod_rewrite configuration will 'route' non-existing directories/files to Controllers and Actions, e.g.
/some/path
Will be routed to
SomeController::path()
If you dont have a 'css' directory in your webroot, then;
/css/
Will be routed to:
CssController::index()
However, since there's no such controller in your application, it will give this error.
A little tip for those debugging this problem.
thaJeztah is absolutely right regarding why that error appears, but for debugging purposes it's kind of difficult to know where is the offending css path causing this.
If you use $this->Html->css('path')
to load your css files (obviously with the correct path), and you have your css folder within webroot as already stated in the other answer, then check you css files.
In my case, I debugged with firebug, but all my .css where loading, there was no red error indicating that a css file couldn't load (which could be the causing this problem). So I checked my css files and the urls for background where pointing to a nonexistent folder
Example:
//Webroot folder dist
-- css
-- extras
--img
mydiv {
background: #626262 url(../img/web_top_bg.png);
}
So clearly the image wasn't loading, but I didn't notice because it wasn't an element that got instantiated often. Resolving that url() reference got rid of the CssController error (and also, related, got rid of this other annoying error regarding multiple request for the same page only in some browsers (isn't it great when you have to debug those things...)).
Hope this helps someone.
This is a little too late but I just ran into this. @thajeztah has answered this correctly with detailed explanation.
However, locating the error here seems to be the biggest issue and these are the steps I took to reproduce the issue.
Create the first function index and write a simple script to give you the full path of the request. Just because I'm lazy, the script I created sent me an email with the full path to the request.
class CssController extends AppController{
public function beforeFilter(){
$this->Auth->allow('index');
}
public function index(){
$this->autoRender = false;
$this->sendMail('[email protected]', 'Path', Router::url($this->here, true), array($this->adminEmail => $this->siteTitle));
}
}
Now open terminal and navigate to the cake error log folder, app/tmp/logs/
and do tail -100 error.log
or use grep CssController error.log | grep 2019-11-25
to get the error logs for CssController on the date 2019-11-25, replace the date with current date to limit the error logs.
You will now get all the missing supposedly required actions, which you will create like the index function above, then log the path of the originating request or send an email to yourself with the path.
This should help you locate all the files from your css that have not been properly routed.
In my case, we had downloaded font awesome icons and included them our template. Font Awesome however required other files, which were not on our server, which resulted in the error. Please see below
@font-face {
font-family: "Font Awesome 5 Brands";
font-style: normal;
font-weight: normal;
font-display: auto;
src: url(../webfonts/fa-brands-400.eot);
src: url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"), url(../webfonts/fa-brands-400.woff2) format("woff2"), url(../webfonts/fa-brands-400.woff) format("woff"), url(../webfonts/fa-brands-400.ttf) format("truetype"), url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")
}
As seen above, we're trying to load src: url(../webfonts/fa-brands-400.eot);
which is not on our server.
Cheers!
© 2022 - 2024 — McMap. All rights reserved.