RE: [PHP] include files or fopen

2002-06-30 Thread David Freeman


 > I am trying to write a program that is very modular in 
 > nature & one of the
 > features I need the user to be able to do is install/uninstall or
 > enable/disable the module though the interface.

I have, in the past, stored such information in a database.  In projects
that have need of such functionality I create a modules table and use
that to store what information I need - normally that's a path to the
module, the name of the config file for that module and any other
relevant bits that the project as a whole needs to know about.

Then when a page loads it can check for any appropriate modules in the
process and deal with them accordingly.

CYA, Dave




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] include files or fopen

2002-06-30 Thread Lee

Hi,

I am trying to write a program that is very modular in nature & one of the
features I need the user to be able to do is install/uninstall or
enable/disable the module though the interface.

I have though of 2 ways this could be done, either when the module is
installed it adds additional lines to an include file, which means the next
time the page is loaded the new module will also be included.  Alternatively
I though of writing my own config files and using fopen etc to read in the
values and store them as appopriate.

If I was writing this as a compiled program in C / Java, I would definately
use the fopen method as the operation only needs to be done either a program
start or when a new module is added.  However with PHP the operation would
need to be done on each page request.

As far as I can tell both methods ultimately come down to opening a file and
reading it in, but I would think that the built in include directive would
be less of a performance risk that writing my own handler.  The problem is
by using include files I run the risk of if my script/server crashes
half-way though a write or the user makes an error when editing the page
directly it would possibly bring down the whole app, where as if I read the
values in via my own file & methods I can ensure that the values and syntax
are valid before acting upon what is read in.

Therefore if my assumptions are correct I am caught between either possibily
having a faster program but is possibly not a resiliant to error, or a
slower program that is more resiliant and can exit nicely on error.

Any thoughs that people have on this would be appriciated.

Regards

Lee


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php