[pmwiki-users] AutoCreatePages

Lars Eighner surname at larseighner.com
Wed Feb 27 00:09:44 CST 2013


Included here two corrections to the Cookbook pages.  I cannot figure out
how to use the talk page for the AutoCreatePages page (and besides either
the Cookbook is down now or my upstream cannot find it).

1)The array created in the based-on AutoCreateTarget immediatedly below the
credit PM

It has hash keys of pat, name, and page.  Page is wrong as explained in
big comment below.  The three hash keys should be pat, name, and init.

This is from an actual working example:

$AutoCreatePages = 
array(    array(   'pat' => '/Main/i',
'name' => 'Comment.{$Group}-{$Name}', 
'init' => array('ctime' => $Now, 'text'=> urldecode($commentform) )));

(The text is urldecoded because I happened to use HEREDOC to create it.
HEREDOC is effectively double quoting so php attempts to evaluate anything
with a dollar sign in front of it which will usually be empty. $,%, and +
have to be urlencoded  - there may be more).


2)Unbalanced parentheses in the following line:

if (!($pn = MakePageName($pagename, FmtPagename($pnfmt, $pagename))) return;

Fix by sticking in another close parenthesis before the return.


That concludes typos observed in the Cookbook/AutoCreatePages.


-- 
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266




More information about the pmwiki-users mailing list