Re: Setting a non default.thtml layout for a ''app/view/pages .thtml file
Hi Andrew, Thanks for the reply. I actually am trying to avoid messing with cake/libs/controller codes. Your way by overwriting pages controller is working fine, but if there's no current cake's elegant workaround on it I'm considering to mimic its functionality by creating a statics controller and adding it to the routes config. That way future updates in cake core won't affect my apps. Though I doubt there'll be major changes in cake's way with the pages controller or critical use with it in the core, it's better to play safe IMHO. Just exploring and learning best cake practice with the small stuff. Thanks again. Uwie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Setting a non default.thtml layout for a ''app/view/pages .thtml file
hi To avoid messing the core, in your /app/app_controller.php (create one if none): class AppController extends Controller { function beforeRender() { if ($this-name == 'Pages' $this-action == 'your_static_page') { $this-layout = 'other_layout'; } } } If I remember well, I saw a method to set your layout in the view file, maybe you can search it in the group neospirit a écrit : Hi Andrew, Thanks for the reply. I actually am trying to avoid messing with cake/libs/controller codes. Your way by overwriting pages controller is working fine, but if there's no current cake's elegant workaround on it I'm considering to mimic its functionality by creating a statics controller and adding it to the routes config. That way future updates in cake core won't affect my apps. Though I doubt there'll be major changes in cake's way with the pages controller or critical use with it in the core, it's better to play safe IMHO. Just exploring and learning best cake practice with the small stuff. Thanks again. Uwie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Setting a non default.thtml layout for a ''app/view/pages .thtml file
Just have $this-layout = 'your_other_layout'; inside your view. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Setting a non default.thtml layout for a ''app/view/pages .thtml file
Uwie, I'd take a copy of cake/libs/controller/pages_controller.php and paste in into app/controllers/ Add the following into app/controllers/pages_controller.php: var $layout = 'your_custom_layout'; Create 'your_custom_layout.thtml' in app/views/layouts/ and hopefully Bob's your uncle :-) HTH, Andrew neospirit wrote: Hi all. I need to set the layout for a static page in my views/pages to another layout already in my views/layouts so it's not going to use the default.thtml one. I've searched the group and found none, and I believe I've missed the part about views/pages in manual if there's any. So, is it possible to do something about this? Helps really appriciated. Uwie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---