Ajay_Kumar
Ajay_Kumar

Reputation: 1387

CSS file is not linking

After loading web page my CSS file is not linking.. I have kept CSS file in app/view/layout/css and also in app/webroot/css/ my controller is in app/controller/DashboardsController.php and my view is app/view/Dashboards/index.ctp. And router is linking like Router::connect('/', array('controller' => 'dashboards', 'action' => 'index', 'home'));.

Website is running in subdomain...line .. subdomain.maindomain.com I am new in cakephp can you plz tell me why CSS file is not linking...

Upvotes: 0

Views: 209

Answers (1)

dciso
dciso

Reputation: 1264

Generally you put your css etc. in the webroot folder:

app/webroot

So say for example the path was

app/webroot/css/myfile.css

Then when you include the files it would be:

<link rel="stylesheet" type="text/css" href="/css/myfile.css">

Or use CakePHP shorthand

echo $this->Html->css('myfile');

If this isn't working then I'd check your .htaccess. Try in your browser to access the file directly: subdomain.maindomain.com/css/myfile.css . If this fails I'd say its the .htaccess.

Upvotes: 1

Related Questions