config.php

Summary: config.php tips and tricks
Version: 0.0
Prerequisites:
Status:
Maintainer:
Discussion: ConfigPhp-Talk
Categories: Administration

Description

Things you really wanted to know, but were afraid to ask, about config.php.

The following questions and answers will assist with local customizations of your website.

Please note that any direct function call in config.php, like ResolvePageName(), CondAuth(), PageTextVar(), PageVar(), RetrieveAuthPage(), or others, should be done near the end of config.php.

How do I test for the current page name in config.php

Use the code

$pagename = ResolvePageName($pagename);
if ($pagename=='HomePage') { /*do something...*/}

How do I test for the current group name in config.php

Use the code

list($group, $name) = explode('.', ResolvePageName($pagename));
if ($group=='PmWiki') { /*do something...*/}

How do I keep track of changes to config.php

  1. Use some form of revision control
  2. Judicious use of comments:
## flip box
## added Sept 10, 2009 by John Doe
## https://www.pmwiki.org/wiki/Cookbook/Flipbox
## nice, but won't work on included pages.
    include_once($FarmD.'/cookbook/flipbox.php');

I put in title of recipe, add date (not as important if you use revision control, but can be a quick reference, sometimes), author if multiple people edit the file, home page, brief comment.

OtherMichael September 21, 2009, at 08:25 AM

See also

Contributors

simon

Comments

See discussion at ConfigPhp-Talk

Place your per-group and per-page customizations in config.php rather than in separate PHP scripts.

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.