Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to force use other controller's method in before()?
  • I have extends base_controller and another controllers in module have to extend this base_controller.
    In this base_controller i have to check before it runs that is this module disabled or enabled.
    If it was disabled all URL come to this controllers under this module must force to some where eg. closedPage().

    In the base_controller i can use route() to check disabled module and if it is in disabled condition, make it use closedPage() method. but when it's not in disabled condition, the page just white out.

    if i change from route() to use before(), i cannot force use closedPage() method.

    How to force use closedPage() method in base_controller?

    namespace MyModule;

    class Controller_BaseController
    {
        public function before()
        {
            if (\Model_Config::get('module_disabled') === true) {
                return $this->closedPage();
            }
        }

        public function closedPage()
        {
            return \View::forge('front/controllerbase/disabled_v'); // << nothing come out.
        }
    }

  • SyntaxlbSyntaxlb
    Accepted Answer
    You need to do an HMVC Request, or use a redirection with \Response::redirect()

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion