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?

View Replies: View Best Answer
SteveAtParadigm replied on at Permalink Reply
Is this what you are looking for?
mdzoidberg replied on at Permalink Reply
You can create the controller inside your controllers folder and i believe you can just call it like this


focus43 replied on at Permalink Reply
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.
dbaggs replied on at Permalink Best Answer Reply
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.


focus43 replied on at Permalink Reply
You are the man. Thanks!