Good day everyone !
I have a Cakephp 3 project.
File src/Template/Layout/Default.ctp contains code (header, footer..) to import some vew like src/Template/User/index.ctp or src/Template/Posts/add.ctp automatically.
But it is Admin Panel, now I want build views for front-end, I dont want to use the same layout.How can I use different header/footer layout for src/Template/Home/index.ctp... ?.
Here is my folder
![[1]](https://i.sstatic.net/liqHZ.png)
Tks for reading !
You need the set the layout in your Controller or define some conditions on which the frontend View should be loaded in /src/View/AppView.php.
See the docs.
For the Controller approach:
// Set the layout.
$this->viewBuilder()->setLayout('admin');
// Before 3.4
$this->viewBuilder()->layout('admin');
// Before 3.1
$this->layout = 'admin';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With