Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Cannot redeclare class Controller_admin
  • Hi Guys I'm trying to create base controllers here's what i have done: /app
    ----classes/
    controller
    base
    admin.php
    public.php
    member.php /app/controller/classes/base/admin.php
    <?php
    
    class Controller_Base_Admin extends \Controller_Template {
    
    }
    

    Then in modules\admin\classes\controller\admin.php
    <?php
    
    Class Controller_admin extends \Controller_Base_Admin {
    
    }
    

    I get this error.
    ErrorException [ Compile Error ]: Cannot redeclare class Controller_admin what am i doing wrong?
  • Modules have to be in their own namespace. So if you have a module called admin, it should be
    <?php
    
    namespace Admin;
    
    Class Controller_admin extends \Controller_Base_Admin { }
    
  • Keep the capital letters sorted too, Controller_Admin not Controller_admin.
  • Ok, Thanks guys

Howdy, Stranger!

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

In this Discussion