Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Cannot redeclare class when using Routes and Modules
  • I've got the following line in my routes.php config: 'apple-macbook-pro' => 'product/product', In my modules folder: product/classes/controller/product.php: class Controller_Product extends Controller Then added this to config.php: APPPATH.'modules'.DS When I visit /apple-macbook-pro I get: ErrorException [ Compile Error ]: Cannot redeclare class Controller_Product But there are no other controllers called product!
  • Totally forgot the "namespace Product;" bit. Is there a way to manage the namespaces without having to put \ before every FuelPHP class?
  • Yes, list all the ones your going to use at the top, using the "use" statement, which will "import" them into the current namespace. Not sure if that is any better, and you will contaminate the current namespace with classes defined elsewhere, so be careful of collisions...

Howdy, Stranger!

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

In this Discussion