CodeIgniter Forums
Application Package and MY_helperName - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Application Package and MY_helperName (/showthread.php?tid=52783)



Application Package and MY_helperName - El Forum - 06-26-2012

[eluser]coldscooter[/eluser]
I'm using a 'package' to hold shared resources between two apps i'm running on the same CI deployment. It's great for sharing libraries, models and helpers.

But it won't recognise when i put extended helpers/models in there (MY_helperName). Which means i'm ending up with lots of duplicates of extended helpers and classes in each app.

Does anyone know how to fix this?


Application Package and MY_helperName - El Forum - 06-26-2012

[eluser]tomcode[/eluser]
I choose one of the apps to be my 'main' application. It contains the extension files.

In the other apps I put files which point to the original :

Code:
// pseudo MY_Config.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once(dirname(APPPATH) .'/main_application/core/MY_Config.php');



Application Package and MY_helperName - El Forum - 06-26-2012

[eluser]coldscooter[/eluser]
So you are still creating the MY_Config.php in every app, but just pointing to the shared version?

It would work but seems a little hacky.

It's a shame that this isn't set up by default.

I also can't put my database settings in the shared app. Anyone else experience this problem?


Application Package and MY_helperName - El Forum - 06-26-2012

[eluser]tomcode[/eluser]
Yeah, I have not found another solution. I use the same technique for the database settings. I did not like it in the beginning, but I have now several sites up like that and it works good.