debian-sf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Debian-sf-devel] Plugin infrastructure -- Request for comments


From: Tim Uckun
Subject: Re: [Debian-sf-devel] Plugin infrastructure -- Request for comments
Date: Fri, 15 Nov 2002 12:26:12 -0700

> You do run into the problem of plugins stepping on each other, then,
> though.

"  Not if the insertion points are integrated into the main code and
managed centrally.  I do not believe there will be hundreds of plugins
requiring manual intervention anyway, so it should be manageable
without too much hassle."

Here is what I have done in the past and it has always worked for me.

I have a code snippet (it has to be a global thing) which is run on every page. This function traverses the all the parent directories including any files whose names are globals.inc. In this way each directory becomes a small mini application. Anything in the globals.inc is visible to all directories lower in the chain. I also have a locals.inc which contains functions and values that are only used by other files in the same directory. This works very well for me as a method of encapsulating. If you use a fusebox type of approach then every directory has an index.php which includes globals.inc (there is one in the include directory which contains my function) which then goes on to include all other globals.inc up the directory hierarchy. Simple neat and you never have to worry about every page having a bunch of includes. Here is the snippet.


$offset=0;

// Always include this file

$global_filename = $DOCUMENT_ROOT . '/globals.inc';

if (is_file($global_filename)):
        include $global_filename;
endif;

while ($offset = strpos ($PHP_SELF, '/',$offset + 1)):
$global_filename =$DOCUMENT_ROOT . substr ($PHP_SELF, 0, $offset) . '/globals.inc';
   if (is_file($global_filename)):
        include $global_filename;
    endif;
endwhile;



This might be a part of the solution.

:wq
Tim Uckun
US Investigations Services/Due Diligence
 http://www.diligence.com/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]