Where is the default controller?

Permalink
I need to set a variable (actually run a query and set a variable) and use this variable in my footer template (just an included php template), but I don't know where/what controller I need to put this code into. Is there a default controller+action that is run for each page request that I can edit? I don't want to edit the concrete source, of course.

Thanks,
Blake

blakeage
 
Mnkras replied on at Permalink Reply
Mnkras
page type controllers could work not really sure what you are trying to do
blakeage replied on at Permalink Reply
blakeage
I have code that needs to run on every page of the site(in a controller), because it has to do with navigation that is displayed in the site footer. It belongs in a controller, but I don't know what controller that is.

In Ruby on Rails, there is the concept of an "application" controller, which runs for every page request, and your controllers all inherit from this controller. So you can put code in the application controller that will always run. I didn't know if Concrete had a controller like this.

If not, how would you execute controller code on each page request?
Mnkras replied on at Permalink Reply
Mnkras
It does, its just not the preferred way to do it, you can copy /concrete/libraries/controller.php to /libraries/ and edit it,

There is probably a better way... What exactly are you trying to do?
blakeage replied on at Permalink Reply
blakeage
I'm inserting an auto-nav block in my footer(programmatically); however, I need to run a query to get a specific page from the database to use as the parent page for the auto-nav. So this query I want to put in a controller somewhere, and needs to always run (since the footer is on every page).
Mnkras replied on at Permalink Reply
Mnkras
so you want to get the parent of the current page?
blakeage replied on at Permalink Reply
blakeage
No, it's some other page not having to do with this page. I meant parent meaning, the page would serve as the parent for the auto-nav (the auto-nav generates a list of pages below the provided parent page).
fregas replied on at Permalink Reply
fregas
anyone find a solution to this short of overriding the Concrete5 controller?
fregas replied on at Permalink Reply
fregas
Hello? (Sound of crickets churping...)
andrew replied on at Permalink Best Answer Reply
andrew
As of 5.4.2, there isn't a default controller. I would advise you to create a custom helper for this item or just run the code in the footer.

This is a good idea, however – we just haven't put it in place.
fregas replied on at Permalink Reply
fregas
Ok, then in future projects i'll probably make a page type controller for each page type, then have them all inherit from a parent controller. But it would be nice if this was already set up in the CMS architecture.

Thanks!