I have a general layout. (default)
But for users pages, I should add a panel to each page.
I tried $this->renderLayout('panel_code', 'default');, but didn’t work; and printed default layout view view content! with no panel_code!
Where’s my mistake?
You should make elements in
View/Elementsfolder with.ctpextension.This link would help you to make clean separation of your view files with the related/repeated code.
An element is basically a mini-view that can be included in other views, in layouts, and even within other elements. Elements can be used to make a view more readable, placing the rendering of repeating elements in its own file. They can also help you re-use content fragments in your application.
Elements live in the /app/View/Elements/ folder, and have the .ctp filename extension. They are output using the element method of the view:
You can pass variables from your view to the element.
In your view:
In view-goal.ctp element you can directly access
$historyvariable.