Chris,
I think that I solved this problem and the problem of how to handle
upgrades by making a few simple changes to the way include files are located.
I start by defining two constants: APP_MOD_PATH and FT_MOD_PATH in the
index.phtml file. FT_MOD_PATH is the absolute path to the standard FreeTrade
modules. Then APP_MOD_PATH points to an application specific copy of the
directory hierarchy of FreeTrade. The Application specific copy of FreeTrade
directory only contains those files which have been modified.
I then changed a few key files to first look in APP_MOD_PATH and then in
FT_MOD_PATH for the file to be included. By doing things this way, it becomes
very easy to fix problems that are found in FreeTrade locally by creating a new
version of the file and placing it in the FT_MODE_PATH path. Then when the
problem is fixed, the new version can simply be deleted.
In the example of including screen files in the screen layout file, the
following code can be used:
if (file_exists(APP_MOD_PATH . "screens/$SCREEN")) {
include(APP_MOD_PATH . "screens/$SCREEN");
} else {
include(FT_MOD_PATH . "screens/$SCREEN");
}
If you do things this way then you can modify or create new screens at
will, while default screens can be safely left alone. When a new version of
FreeTrade comes out, you simply update the files in the FT_MOD_PATH hierarchy
and your application specific changes are safely preserved.
The same method works for including actions, global_settings, layouts,
etc..
We have actually found that there were a few changes that were common to
the applications that we made. So we extended the above system by adding
another layer between the default FreeTrade code and the Application code:
if (file_exists(APP_MOD_PATH . "screens/$SCREEN")) {
include(APP_MOD_PATH . "screens/$SCREEN");
} elseif (file_exists(ABOT_MOD_PATH . "screens/$SCREEN")) {
include(ABOT_MOD_PATH . "screens/$SCREEN");
} else {
include(FT_MOD_PATH . "screens/$SCREEN");
}
I would appreciate any feedback on this. The only real drawback that I
have found is that obviously the number of hits to the file system is
increased, but given the amount of time it saves customizing applications, we
viewed that as acceptable.
Leif
Chris Griffin wrote:
> I am new to freetrade so this may have been discussed before. I would like
> to put as much of the functionality of freetrade into a common php include
> directory. I am going to be hosting more that one e-commerce site and would
> like to just put the client specific stuff in their htdocs directory. Has
> anyone done this? Have the developers thought about this? Thanks for any
> help.
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Site: http://www.working-dogs.com/freetrade/
> Problems?: [EMAIL PROTECTED]
--
-----------------------------------------------
Leif Mortenson
Silver Egg Technology
Kondo Ebisu Bldg. 802
1-20-8 Ebisu-nishi
Shibuya-ku, Tokyo 150-0021 JAPAN
Tel: 03-5456-8044
Fax: 03-3462-5045
Email: [EMAIL PROTECTED]
URL: http://www.silveregg.co.jp
-----------------------------------------------
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]