• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Config files loaded twice, also How to separate Applications but share things

#1
Hello,
I'm using "Ion Auth".

I want to have a different Application for Administration and another for Users

/admin
/application
/system
index.php (system and application folders)
administration.php (system and admin folders)

But I want to still use the same libraries and stuff in application folder (so when I update them, the administration area libraries/configs are also updated)

For example for configs.php in admin app I did this:

PHP Code:
<?php

require_once(__DIR__.'/../application/config/config.php');

// Stuff that need new value
$config['base_url']            = $config['base_url'] .  'admin/';
$config['cookie_path']      = '/admin';
$config['cookie_prefix']    = 'admin'

I'm going to do the same for everything shared between them.

I have two questions:
1. Is this the standard way of doing this (separating apps while sharing some files with require_once)?
2. require_once doesn't work! it seems config files (any new config file added to CI) are being loaded twice! and Ion Auth community thinks it's a CI issue (shouldn't CI avoid loading stuff if they are already loaded?)

Issue on Github (Related to my #2 Question):
https://github.com/benedmunds/CodeIgnite...ssues/1000

P.S. If you're wondering why I'm separating them, because those are 2 separate areas, I don't want any update to admin area cause unwanted issues for users or the other way around, also I can protect the administration.php file much better when it's separated, never to worry about Brute Force or anything like that.
Reply

#2
CodeIgniter automatically loads the main config file ... https://www.codeigniter.com/user_guide/l...onfig-file
Your "require_once" conflicts with that.

If you want to over-ride config items, perhaps https://www.codeigniter.com/user_guide/l...onfig-item

Your admin vs application question is an entirely different issue ... I'm going to sit back and wait for the HMVC flame wars to reignite Undecided
Reply

#3
Three application on a same platform:
https://github.com/ivantcholakov/starter...plications

Common code and configuration that these applications share:
https://github.com/ivantcholakov/starter...orm/common

Good enough? You need to integrate Ion Auth alone though.
Reply

#4
(04-09-2017, 11:03 AM)ciadmin Wrote: CodeIgniter automatically loads the main config file ... https://www.codeigniter.com/user_guide/l...onfig-file
Your "require_once" conflicts with that.

If you want to over-ride config items, perhaps https://www.codeigniter.com/user_guide/l...onfig-item

Your admin vs application question is an entirely different issue ... I'm going to sit back and wait for the HMVC flame wars to reignite Undecided

Thank you for replying,
So basically my assumption that CI checks if a config file is already loaded to prevent loading it again is wrong.

(04-09-2017, 11:59 AM)ivantcholakov Wrote: Three application on a same platform:
https://github.com/ivantcholakov/starter...plications

Common code and configuration that these applications share:
https://github.com/ivantcholakov/starter...orm/common

Good enough? You need to integrate Ion Auth alone though.

Thank you,
Awesome Examples.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.