Saturday, September 29, 2012

Themes

For the first time, I have to use themes in a project.

I am using Cakephp 2.1

In the before filter of the app controller I have the following:

$this->theme = 'corporate';

I have the views under

app/view/themed/corporate/layout/default.ctp 

This is working fine..

My problem is the webroot.

I used  

//main.css is under webroot/themed/corporate/css/main.css
<?php echo $this->Html->css('main'); ?>


The page is rendered with:  

<link rel="stylesheet" type="text/css" href="/css/main.css" /> //file not found

I can manually put in the link 

<link href="<?php echo $this->webroot; ?>themed/corporate/css/main.css" rel="stylesheet" type="text/css" /> 
becomes
<link href="/themed/corporate/css/main.css" rel="stylesheet" type="text/css" /> //good



I thought when I used the HTML helper it was supposed to properly identify the theme and update the link accordingly.

Am I wrong in that assumption?

Thanks!


--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: