[Pmwiki-users] InterMap definitions

Patrick R. Michaud pmichaud at sci.tamucc.edu
Mon Feb 17 17:30:13 CST 2003


> I put scripts that I write in the scripts directory, 'cos I thought that's 
> what it was for. I put group-specific stuff in the local directory, also 
> 'cos I thought that's what it was for, being where pgcust.php looks.

I must also confess that I'm making a lot of this stuff up as I go along.
:-)  I created local/ to handle the group-specific stuff, and then over
time realized it was a good place for non-group-specific but 
non-PmWiki-generic stuff as well.  I like to keep my root directories
relatively uncluttered with files.  For example, it might also make
sense to move intermap.txt, localmap.txt, and local.php to be somewhere
else other than the pmwiki/ root, but I haven't figured out where yet.

If someone wants to propose a new subdirectory structure for housing
the various pmwiki-related files, I'm open for suggestions.  Propose
what would be best w/o worrying about backwards compatibility.  I'm a
bit concerned that I may soon reach a point where I have to decide 
between backwards compatibility and an important PmWiki improvement, 
and if backwards compatibility loses out then that's the best time to 
incorporate any other "semi-radical" changes that need to be made
(such as redesigning the script/subdirectory structure).

> I worried about the change I made to trails.php to cope with 
> {{free links}} and will rename it x-trails.php.

Alternatively I suggest keeping it as trails.php but putting it in the
local directory.  I.e., the local/ directory is a good place for scripts
that slightly differ from the ones in scripts/.  Since script names
begin with a lowercase letter there's not a problem with it conflicting
with group scripts (which begin with uppercase letters), at least not
on the systems I've created to date.

> Extensions may have to be loaded in a specific order (freelinks.php 
> has to load first for some other things to work, for example). 
> The rule would be that they load alphabetically.

In general I agree with the rule of loading alphabetically, and files 
can be named starting with digits (e.g., "00-freelinks.php", 
"05-bigtext.php", etc.).  However, another solution to scripts-requiring-
other-scripts is to use include_once() instead of include() and make
sure that each script includes its dependencies at the beginning.  For
example, if x-trails.php requires freelinks.php, then put the line
	include_once("local/freelinks.php");
at the beginning of x-trails.php.  

Then, even if local.php does
	include_once("local/x-trails.php");
	include_once("local/freelinks.php");
it's okay because the x-trails.php include will automatically grab the
freelinks.php script, and the second include in local.php will not
try to load it a second time.  I.e., every script should include
its own dependencies at the beginning rather than requiring local.php to 
load things in the proper sequence.

> If pmwiki automatically loads everything in the extensions directory, 
> how would that cope with conditional includes? Does it need to?

Actually, the need to do conditional (per-group) includes pretty much
convinces me against trying to automate script includes, and aiming
instead at really clear documentation for people about how to accomplish
what they want.  I'm afraid that the per-group stuff will just really
complicate the whole system waaaay too much.

One last comment--in general I'd prefer to *not* put too much
administrative overhead in pmwiki.php -- i.e., it should be a separate
script if it exists.  In general I think pmwiki.php needs to be efficient
at loading and processing typical page loads, since in theory the 
non-administrative requests will greatly outnumber the administrative 
ones.  So, if we want to build systems to make it easier to configure
pmwiki, perhaps those should be separate scripts or a separate subsystem.

More later, I hope!

Pm





More information about the pmwiki-users mailing list