alaminio
alaminio

Reputation: 80

CakePHP theme is not working on live server

I created a website using CakePHP. Here: http://www.aaryanahmed.net/

I used cakephp theme. Theme path is app/view/Theme/orange. It workes fine in my localhost but now working when I uploaded it by Cpanel.

In AppController I introduced the theme in this way

public function beforeRender() {
if (
        $this->params['action'] == 'index'
        || $this->params['action'] == 'edit'
        || $this->params['action'] == 'add' && $this->params['controller'] != 'contacts'
        || $this->params['action'] == 'delete'
        || $this->here != 'http://www.aaryanahmed.net/'
    ) 
    {
        $this->theme = null;
    }

else if($this->params['plugin'] == 'usermgmt')
    {
        $this->theme = '';
        $this->layout = 'usermgmt';
    }
else {$this->view = "Theme";
    $this->theme = 'orange';
}

}

Theme is not working even if I use $this->theme = 'orange'; in AppController My htaccess file is lihe that

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

Upvotes: 0

Views: 344

Answers (1)

user221931
user221931

Reputation: 1852

Is your developing computer windows and the server linux? Then it can be a problem of not following conventions and/or naming folders other than what is expected from the framework. In unix systems Test is different from test. Windows treats them the same.

For example you mention app/view/Theme/orange which should be app/View/Theme/Orange. The documentation says explicitly that it's important to remember that CakePHP expects CamelCase theme names.

Also consider that your code doesn't follow cake's coding standards either. Although those guidelines are for the framework it helps maintain a common presentation for all cakephp code presented here.

Upvotes: 1

Related Questions