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

Just thinking about the best way to build an Order form that would (from
For about a year I have been thinking about writing a program that writes
I was thinking about doing a take_timing function that would take the timing of
Thinking about a Windows-hosted build process that will periodically drop files to disk to
Thinking about avoiding code replication, I got a question that catches me every time
Without thinking about it at all I just want to say I should allow
Currently thinking about pitching the argument for us migration from vs 2005 (winforms) to
When thinking about iPhone/iPad applications security, I can notice that there is: Widely available
I am thinking about building a project, that in the name of custom expanding
I´m thinking about to write an application will have to store a small amount

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.