Welcome Guest, Not a member yet? Register   Sign In
Config files in modules
#1

Hello

I am wondering what the best practices are for adding specific modules configs. I followed the documentation but it seems I am either missing something or it does not work all the time.

In app > Config > Modules.php you can add $aliases. Yet when I add constants to this array it does not get loaded.

So in retrospect what is the best way of adding configs that they are sertan to be loaded.
Reply
#2

The modules namespace should be added to CodeIgniters Config/Autoload.php
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Yes I know and I also did that. Stil the Constants.php is not beeing loaded.


PHP Code:
'Modules/Admin'        => ROOTPATH 'modules/admin'// The Admin Module
'Modules/Users'        => ROOTPATH 'modules/users'// The User Module 



Or is it required to also add the modules Config path to this list?
Reply
#4

(This post was last modified: 03-13-2021, 12:45 PM by InsiteFX.)

I use a Config file for all my constants and place it in the modules folder under config then I
can load it myself.

But if you add your constants to the Config/Constants.php file they should load.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

What I did is the following

>modules >Admin >Config -Constants.php

added my required constants

But when I try to use them in the specific module
ErrorException
Use of undefined constant ADMIN_TEST - assumed 'ADMIN_TEST'
Reply




Theme © iAndrew 2016 - Forum software by © MyBB