[pmwiki-users] error in pgcust.php with 2.beta55
Daniel Scheibler
scheibi at gmail.com
Fri Aug 26 04:06:56 CDT 2005
Hello,
the pgcust.php runs in my farm only the
PerPage customization. The PerGroup config files aren't
included.
I think it will be better to change pgcust.php to:
<CODE>
<?php if (!defined('PmWiki')) exit();
/* Copyright 2002-2004 Patrick R. Michaud (pmichaud at pobox.com)
This file is part of PmWiki; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. See pmwiki.php for full details.
This script enables per-page and per-group customizations in the
local/ subdirectory. For example, to create customizations for
the 'Demo' group, place them in a file called local/Demo.php.
To customize a single page, use the full page name (e.g.,
local/Demo.MyPage.php). Per-page/per-group customizations can be
handled at any time by adding
include_once("scripts/pgcust.php");
to config.php. It is automatically included by scripts/stdconfig.php
unless $EnablePGCust is set to zero in config.php.
A page's customization is loaded first, followed by any group
customization. If no page or group customizations are loaded,
then 'local/default.php' is loaded.
A per-page configuration file can prevent its group's config from
loading by setting $EnablePGCust=0;. A per-page configuration file
can force group customizations to be loaded first by using include_once
on the group customization file.
*/
SDV($DefaultPage,"$DefaultGroup.$DefaultName");
if ($pagename=='') $pagename=$DefaultPage;
$f = 1;
if (!IsEnabled($EnablePGCust,1)) {
return;
}
$group = FmtPageName('$Group', $pagename);
$name = FmtPageName('$Group.$Name', $pagename);
// mandatory for farm configutation
if (file_exists("$FarmD/local/farmconfig/$group.php")) {
include_once("$FarmD/local/farmconfig/$group.php");
$f = 0;
}
// necessarry if one farm group will stop PerPage customization
if (!IsEnabled($EnablePGCust,1)) {
return;
}
if (file_exists("$FarmD/local/farmconfig/$name.php")) {
include_once("$FarmD/local/farmconfig/$name.php");
$f = 0;
}
// necessarry if one farm page will stop PerPage customization
if (!IsEnabled($EnablePGCust,1)) {
return;
}
// normal field configuration
if (file_exists("local/$group.php")) {
include_once("local/$group.php");
$f = 0;
}
// necessarry if one group will stop PerPage customization
if (!IsEnabled($EnablePGCust,1)) {
return;
}
if (file_exists("local/$name.php")) {
include_once("local/$name.php");
$f = 0;
}
// necessarry if one page will stop PerPage customization
if (!IsEnabled($EnablePGCust,1)) {
return;
}
if ($f &&
IsEnabled($EnablePGCust,1) &&
file_exists('local/default.php')) {
include_once('local/default.php');
}
</CODE>
I think this code is much easier to read and bug fix ;o)
Greets,
scheiby.
--
Daniel Scheibler ========:} student at
eMail: scheibi at gmail.com BTU Cottbus/Germany
WWW: http://www.scheiby.de
More information about the pmwiki-users
mailing list