Wednesday 15 April 2015

php - CakePHP 2.4.1 $this->webroot gives / and not /app/webroot -


I found the CakePHP 2.4.1 project and I do not want to use all HTML, CSS, script assistants because we never Also Cape Depends on PHP because we wanted to change the framework anytime, but when I try to load scripts, styles, images

  & lt; Php echo $ this- & gt; Webroot; ? & Gt; Css / app.min.css  

but it generates a URL

  http://example.com/app.min.css  

$ this-> WebRost just returns /, I'm not very familiar with cake php yet Is there a configuration setting or something that is changing? My VoHost file is a hint at WebRot.

"webtr" directory which is accessible to the public. It contains all your asset elements, should look like this:

  - webroot | - Property | - CSS | - js | - IMG | - index.php // etc  

So when you run $ this-> webroot , you accept the path to your public directory That all the property files will remain in this directory.

In this event it has been modified, just open index.php of your app and find this line:

  define ' WEBROOT_DIR ',' MY_WEBROOT_DIR '); Change  

and MY_WEBROOT_DIR to the actual name of your public directory because it remains in your CakePH application

< / Div>

No comments:

Post a Comment