CodeIgniter Forums
Two Applications -- Shared Config, Helpers ... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Two Applications -- Shared Config, Helpers ... (/thread-19441.html)

Pages: 1 2


Two Applications -- Shared Config, Helpers ... - El Forum - 06-07-2009

[eluser]davste[/eluser]
Greetings, fellow Igniters.

I have come across a tiny (correction: huge) problem. I have to separate application folders respectively called "private" and "public". This is to differentiate between the administration area and the public area (D'oh).

Oh, yes, I also have two PHP files in ROOT, "index.php" and "admin.php" (loads application respectively).

However, both these applications takes use of the same database, and often uses the same helpers (custom, not part of CI). So, instead of duplicating configs, helpers, libraries and such twice, is there no other way to "share" these?

Of course, I do not want to share controllers, models, modules and views. Only the ones that overlap across the applications.

E.g. something like this, perhaps?
Code:
public/
private/
<shared application folder>/
system/
index.php
admin.php
Thanks, best regards from Norway.


Two Applications -- Shared Config, Helpers ... - El Forum - 06-07-2009

[eluser]Colin Williams[/eluser]
Put the custom helpers in system/helpers. And for sharing config stuff, there are amazing things you can do with include() and require()


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]Dam1an[/eluser]
[quote author="Colin Williams" date="1244452187"]And for sharing config stuff, there are amazing things you can do with include() and require()[/quote]

It never ceases to amaze me that people forget they can use normal PHP with CI (and thats not meant as an insult at davste or this particular problem in particular)


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]davste[/eluser]
Aight, then. I though I was going to get some nice hacks or something, but this is just simple. Thanks.


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]Dam1an[/eluser]
Well you could come up with an elaborate hack which would move config to the system, and then overwrite any application specific thing in the application config, but what would involve a fair bit of hacking at the core (well, enough to make it not worthwhile IMO)


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]wiredesignz[/eluser]
Modular Extensions HMVC allows for everything your require. These dummies just don't realize it.


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]Dam1an[/eluser]
[quote author="wiredesignz" date="1244480947"]Modular Extensions HMVC allows for everything your require. These dummies just don't realize it.[/quote]

This 'dummy' doesn't use HMVC so has no way to know


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]wiredesignz[/eluser]
Well maybe you should before you comment otherwise.


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]Dam1an[/eluser]
In my defense, I'm pretty sure the question changed slightly since when I first replied
Before, it was just about accessing the variables in the config file outside that application

Also, does this mean I should read up on every single library before answering any more posts? Tongue


Two Applications -- Shared Config, Helpers ... - El Forum - 06-08-2009

[eluser]wiredesignz[/eluser]
Yes Damian, if you want to give SOLID advice you need to review everything.