Page Type Controller
Permalink 4 users found helpful
Anyone know how to setup a controller for global use by a theme instead of just single pages?
You can create the controller inside your controllers folder and i believe you can just call it like this
Cheers.
Loader::controller($item);
Cheers.
Thanks for the responses, but couldn't get either of those to work.
I'm thinking it has to be something along the lines of what you're saying mdzoidberg... just cant get it.
I'll post if I figure it out.
I'm thinking it has to be something along the lines of what you're saying mdzoidberg... just cant get it.
I'll post if I figure it out.
Hey Jonohartman,
I needed to find this out too so I dug into the code to track how this could be done.
Ultimately, you need to create a controller within your controllers/page_types directory that is named after the Page Type handle. For example, in my case I have an 'event' Page Type and created an event.php file and placed it within the controllers/page_types folder, which I also had to create.
Most importantly, I named the class within <page type handle>PageTypeController (EventPageTypeController), which extends Controller. This is necessary because of how the controller is loaded NB: the 'PageType' section of the class name.
This has taken me a while to work out so I hope this helps.
Regards,
Dan
I needed to find this out too so I dug into the code to track how this could be done.
Ultimately, you need to create a controller within your controllers/page_types directory that is named after the Page Type handle. For example, in my case I have an 'event' Page Type and created an event.php file and placed it within the controllers/page_types folder, which I also had to create.
Most importantly, I named the class within <page type handle>PageTypeController (EventPageTypeController), which extends Controller. This is necessary because of how the controller is loaded NB: the 'PageType' section of the class name.
This has taken me a while to work out so I hope this helps.
Regards,
Dan
You are the man. Thanks!
http://www.concrete5.org/index.php?cID=28266...