Welcome Guest, Not a member yet? Register   Sign In
Creating a new "shared" folder for models and libraries
#1

[eluser]Phil Sturgeon[/eluser]
A common question on these forums (and to me directly) is how to share models and libraries between different applications. As far as I know there is no smooth way of doing this that doesn't involve symlinks as although you can place your shared libraries in the system folder, models are only ever looked for in the application.

For this I knocked together a MY_Loader.php which will look in a "shared" folder which can look something like this:

Quote:/usr/local/codeigniter/system

/usr/local/codeigniter/shared/libraries
/usr/local/codeigniter/shared/models

/home/site-one.com/public_html/config
/home/site-one.com/public_html/controller
/home/site-one.com/public_html/models
/home/site-one.com/public_html/views
/home/site-one.com/public_html/index.php

/home/site-two.com/public_html/config
/home/site-two.com/public_html/controller
/home/site-two.com/public_html/models
/home/site-two.com/public_html/views
/home/site-two.com/public_html/index.php

The code is rough and obviously "SHAREPATH" can be moved somewhere more useful, but my main question is am I approaching this the right way?

If so should I keep going and get things like helpers and plugins working?

It's a shame to sacrifice a MY_Loader to something like this, as MY_Loader is used for so much i.e Modular Separation or Matchbox.


Messages In This Thread
Creating a new "shared" folder for models and libraries - by El Forum - 11-27-2009, 02:45 AM
Creating a new "shared" folder for models and libraries - by El Forum - 11-27-2009, 03:32 AM
Creating a new "shared" folder for models and libraries - by El Forum - 12-20-2009, 02:49 AM
Creating a new "shared" folder for models and libraries - by El Forum - 12-21-2009, 08:36 AM
Creating a new "shared" folder for models and libraries - by El Forum - 12-21-2009, 01:21 PM
Creating a new "shared" folder for models and libraries - by El Forum - 12-24-2009, 04:46 AM
Creating a new "shared" folder for models and libraries - by El Forum - 01-01-2010, 02:26 PM
Creating a new "shared" folder for models and libraries - by El Forum - 01-03-2010, 09:02 AM
Creating a new "shared" folder for models and libraries - by El Forum - 02-18-2010, 10:00 AM
Creating a new "shared" folder for models and libraries - by El Forum - 09-24-2010, 06:53 AM
Creating a new "shared" folder for models and libraries - by El Forum - 07-30-2014, 01:29 PM
Creating a new "shared" folder for models and libraries - by El Forum - 08-04-2014, 08:50 AM
Creating a new "shared" folder for models and libraries - by El Forum - 08-04-2014, 09:35 AM
Creating a new "shared" folder for models and libraries - by El Forum - 08-27-2014, 10:25 AM
Creating a new "shared" folder for models and libraries - by El Forum - 08-29-2014, 09:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB