[pmwiki-users] RecentChanges for AutoGroupPages
John Rankin
john.rankin at affinity.co.nz
Wed Aug 16 19:21:54 CDT 2006
On Thursday, 17 August 2006 11:37 AM, Hans <hans.bracker at googlemail.com> wrote:
>I am trying to have new AutoGroupPages in newgroupbox.php
>added tio (All)RecentChanges, but I have not manage to get it to work
>when autopages are set in the markup.
>
>The PostRecentChanges function works when AutoGroupPages are
>called:
>
>function AutoGroupPages($pagename, &$page, &$new) {
> global $IsPagePosted, $AutoGroupPagesFmt;
> if (!$IsPagePosted) return;
> SDV($AutoGroupPagesFmt, array(
> '{$Group}.HomePage' => 'Templates.HomePage',
> '{$Group}.GroupHeader' => 'Templates.GroupHeader',
> '{$Group}.GroupFooter' => 'Templates.GroupFooter'));
>
> foreach($AutoGroupPagesFmt as $n => $t) {
> $n = FmtPageName($n, $pagename);
> if (!PageExists($n)) {
> $t = FmtPageName($t, $pagename);
> WritePage($n, ReadPage($t));
> PostRecentChanges($n, $new, $new);
> }
> }
>}
>
>But it does not work within function HandleNewGroup when autopages are specified
>in the markup like (:newgroupbox
>autopages=Group.Name1,Group.Name2 :) markup:
>
> if (@$_REQUEST['autopages']) {
> $apages = explode(",", $_REQUEST['autopages']);
> foreach($apages as $p) {
> $tp = explode(".", $p);
> $autopages[$p] = MakePageName($pagename, "$group.$tp[1]");
> }
> foreach($autopages as $t => $n) {
> $n = FmtPageName($n, $pagename);
> if (!PageExists($n)) {
> $t = FmtPageName($t, $pagename);
> WritePage($n, ReadPage($t));
> PostRecentChanges($n, $new, $new);
> }
> }
> Redirect($newpage);
> }
>
>Why would it not work here?
>Note that I had to swap $t and$n around for the autopages condition,
>in order to build the array of new pagenames, but the pages are
>created fine.
>
>Any hints to solve this are much appreciated.
>
>~Hans
>
Is $IsPagePosted set correctly in the second case??
If not, PostRecentChanges will just return.
Try adding an echo "posting $IsPagePosted"; just before the call
to PostRecentChanges (make sure it's available through a global).
It should display 'posting 1'. Hope this helps.
--
JR
--
John Rankin
More information about the pmwiki-users
mailing list