Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1928040
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:55:52+00:00 2026-05-17T06:55:52+00:00

I was thinking about extending all my controllers from the indexController. I have in

  • 0

I was thinking about extending all my controllers from the indexController. I have in the index controller a init() function that does alot of stuff. This is not executed upon fooController request.

I allready have a registered a viewSetup plugin. And this is executed on all requests and thats just fine.

My problem is a have blog module which needs to do some stuff, that don’t need to be done in the news module.

A good example is my secondary menu, its specific to the active module.

class fooController extends indexController In this way i could also override the init() function in indexController from within fooController. Unfortunately the autoloader can’t find the indexController class.

The following works though, if i require the indexController.php file first

<?php
require_once('indexController.php);

class fooController extends indexController {

    function init() {
        parent::init();

        // Do changes to, ie. setup controller specific menu, or add menu items.
    }
}

Ideas much appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:55:52+00:00Added an answer on May 17, 2026 at 6:55 am

    Possible solutions, depends what do you want to do:

    • custom Abstract controller class
    • bootstrap _init method
    • action helper
    • overloading methods
    • controller plugin

    Looks like the controller plugin is the best in this case (since you are already using one),
    but you just need to add some conditions to it, e.g. execute the code only when specific module, controller and action are requested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm about to create a site that will act as public front site of
I have a new app that I am starting tomorrow based on SubSonic3 (ActiveRecord)
I'm about to start working on a new project at a somewhat new job,
I've been learning more about javascript's prototypal inheritance. I know there is a somewhat
I have following scenario: alt text http://static.zooomr.com/images/7579022_e64808b855_o.png We have a WebService which poses as
I'm trying to create a contact form. However at the top of the form
I am trying to build a CMS I can use to host multiple sites.
Is there a way in PHP to overwrite a method declared by one interface
As part of a larger series of operations, I'm trying to take tokenized chunks
Wondering how much effort I should go to forcing useful debugging information when creating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.