0

I'm trying to use themes with CakePHP 2.5.X and I'm failing to load the theme and associated layout inside that theme. What I've done is create "app/View/Themed/Hamilton", and within that directory I've created, "View/Layouts/default.ctp". In "app/Controller/AppController.php" I've done this:

public $viewClass = 'Theme'; /* I've tried $view, it does not work. */
public $theme = 'Hamilton';
public $layout = 'default';

Sadly it loads "app/View/Layouts/default.ctp", not "app/View/Themed/Hamilton/View/Layouts/default.ctp"

I've search stack overflow, no article that talks about this has an answer that works. All debug outputs the proper layout, theme, etc. I've checked spelling and case. It just simply is not loading. Anyone have a fresh perspective?

UPDATE: And once I ask the question I find the solution. The path was wrong to the layout. It should be "App/View/Themed/Hamilton/Layouts/default.ctp" there does not need to be another "View" folder.

Hopefully this may help someone else who has the same issue.

David Cole
  • 41
  • 11

1 Answers1

3

According to the docs, the Layout should be in /app/View/Themed/Example/Layouts/, so in your case it is /app/View/Themed/Hamilton/Layouts/default.ctp, not app/View/Themed/Hamilton/View/Layouts/default.ctp as you said.

Nunser
  • 4,512
  • 8
  • 25
  • 37