Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Module admin controller extends problem
  • I wrote admin login not under app/classes/controller but under the account module. My problem is although the logging in is okay, I couldn't extend this controller. I get class not found error. But I created the controller class and extend it carefully like below

    admin login exist path => APPPATH.modules/account/classes/controller/admin/account.php

    I extended it like that

    <?php
    namespace Mail;
    class Controller_Thankyou extends \Account_Controller_Admin_Account
    {

    public function action_index()
    {
    .....
    }
    }

    Is it possible to extends module admin controller? 
  • The problem you have is probably that the "account" module that contains the class you want to extend isn't loaded, so you get a "class not found" when the framework attempts to load your Thankyou controller.

    There are two solution:
    - define the "account" module in the "always_load" section of your app config
    - change your file to:

    <?php
    namespace Mail;

    \Module::load('account');

    class Controller_Thankyou extends \Account_Controller_Admin_Account
    {
    ...
  • I already loaded the module in always_load. But finally I get solved it by extending the module using back slash like that

    <?php
    namespace Mail;

    class Controller_Thankyou extends \Account\Controller_Admin_Account
    {

    public function action_index()
    {... }
    }

    Anyway, Mr. Harro Verton,Thank you very much for the reply  :)

  • Ah, yeah, missed that. Your module name is a namespace for the controller.

    Glad you've got it sorted.

Howdy, Stranger!

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

In this Discussion