[pmwiki-users] Split a

Hans design5 at softflow.co.uk
Thu Nov 9 03:24:44 CST 2006


Thursday, November 9, 2006, 7:25:44 AM, Lucian wrote:

> I'd like to create "double pages": the top half acts
> like one pmwiki page and may have its own password
> and is editable only by me, and the bottom half acts
> like another pmwiki page and is freely editable without
> password. With a divider between the two.

The page is PmWiki's smallest unit when it comes to security.
Meaning you can't have just part of a page protected with a password
for editing, reading etc.
You can use conditional markup to hide parts and display  them only
under certain conditions, but if you need edit password protection for
your top half and want open edit acces for your bottom half
the only way is to create two pages, and link them together using
(:include GroupName.PageName:) markup.

If you need this on lots of pages one way is to use a different
group for your open pages. Lets call it "Comments". Then you can link
a Comments page with  a Main page by putting in Main.GroupFooter:

(:include Comments.{*$Name}:)

and in Comments.GroupHeader:

(:include Main.{*Name}:)

So you got two pages with the same name in two groups, and you can
protect each group as you wish (for instance edit access only for
you in Main).

Or if two groups is not practicable, you can create Comments pages as
a suffix to your Main pages: A main page called PageName with
a comment page called PageName-Comments, and link the two by putting
into PageName at the bottom:

(:include {*Name}-Comments:)

and into PageName-Comments at the top:

(:include {*$ParentPage}:)

and have {$ParentPage} defined in local/config.php like this,
cutting off the "-Comments" part from the page name:

# add page variable {$ParentPage}
$FmtPV['$ParentPage'] = 'CutString($pn,"-Comments")';
function CutString ($pagename,$cut) {
    $p = str_replace($cut,"",$pagename);
    return $p;
}

You can use a different suffix than -Comments, just replace it in the
page variable definition.


Hans





More information about the pmwiki-users mailing list