[pmwiki-users] What about $SkinDir . . .
Ben Wilson
dausha at gmail.com
Fri Aug 25 17:59:50 CDT 2006
I notice in scripts/skins.php SetSkin() that there is a global
variable $SkinDir. During SetSkin(), it is set to the value of the
valid skin directory, which is itself the result of checking two
places for a skin.[1] For the remainder of the function, $SkinDir is
used to retrieve the template file, etc. However, apart from
SetSkin(), $SkinDir is not used. On first blush, it would appear that
there is no need for a global $SkinDir. On second thought, $SkinDir
could be used in a template to link to skin-specific javascripts, etc.
However, I would like to suggest a change to SetSkin() that allows
$SkinDir to be set in $LocalDir/config.php. This allows the skins
directory to be moved _out_ of pub, if the adminitrator prefers. One
other use for this is to move /pub out of the document root. The
purpose here is to use the same /pub directory on a wiki
plantation---that is, a web server that hosts multiple web sites where
each have a wiki farm with several fields.[2]
For my example below, here is the essential file structure:
/var/www/pmwiki-latest
/var/www/pmwiki-share (which holds /pub)
/var/www/public_html (document root)
I have a working example that helps demonstrate my purpose--Espace.[3]
This wiki field presently contains only two files: index.php and
.htaccess. The index.php file essentially calls pmwiki.php and a
common configuration suite. This common configuration dyamically
generates $LocalDir, activates AuthUser with field-specific variables,
and enables commonly-used recipes. Finally, the common configuration
maps to the field specific wiki.d, and uploads, which are kept in
/pmwiki-share as well.
The .htaccess performs the Clean URLs function. The .htaccess file
also maps any call to /pub to the /pub in /pmwiki-share.[4]
I'm actually almost to the point where I can drop the index.php call
and let .htaccess manage the field. Heck, that almost brings me to the
point where a single .htaccess file at the document root creates a
virtual map of fields.
To move /pub out of document root and out of $FarmD, I would need
$SkinDir and $SkinDirUrl to be configurable by the
$LocalDir/config.php or $FarmD/local/farmconfig.php. I was able to
remove /pub from the example site by adding the following two lines at
line 46:
$sd = FmtPageName("$SkinDir/$s", $pagename);
if (is_dir($sd)) { $Skin=$s; $SkinDirUrl="$SkinDirUrl/$Skin"; break; }
I further set $SkinDir and $SkinDirUrl in the config.php.
--
Ben Wilson
"All this worldly wisdom was once the unamiable heresy of some wise man." HDT
[1]: Specifically, ./pub/skins and $FarmD/pub/skins
[2]: For example, www.dausha.net and www.gmtoolbox.org are on the same server.
[3]: http://www.gmtoolbox.org/espace
[4]: RewriteRule ^/pub/?(.*) /var/www/pmwiki-share/pub/$1 [L,qsa]
More information about the pmwiki-users
mailing list