[pmwiki-users] Checking permissions in the template?

Dominique Faure dominique.faure at gmail.com
Sat Jul 1 07:17:21 CDT 2006


On 7/1/06, Kathryn Andersen <kat_lists at katspace.homelinux.org> wrote:
> On Fri, Jun 30, 2006 at 04:56:02PM -0400, Ryan R. Varick wrote:
> > Perhaps this is a simple question, but I haven't found a solution yet.
> >  Essentially what I want to do is a (:if auth edit:)... at the
> > *template* level.  Specifically, I only want the edit link to be
> > visible if the user has permission to edit the page.
>
> Hmmm, the approach I took with my skin was to do something like this in
> the template:
> <!--markup:(:if auth edit:)(:include {$Group}.PageActions {$SiteGroup}.PageActions:)(:if !auth edit:)[[{$FullName}?action=login|Login]](:ifend:)-->
>
> (though I actually used (:if enabled AuthPw:) which checks if they're
> logged in)
>
> > I see that PmWiki kind of does this by including PageActions.  I tried
> > this approach first, but PmWiki wraps the link in <p> tags, which
> > breaks the container I need to put this link in.
>
> But, yes the above approach does wrap this in <p> tags, so it probably
> won't suit you.
>

In order to prevent automatic <p> tags inclusion, you should try using
a <:block> directive as in:
<!--markup:<:block>(:if auth edit:)(:include {$Group}.PageActions
{$SiteGroup}.PageActions:)(:if !auth
edit:)[[{$FullName}?action=login|Login]](:ifend:)-->

Regards,
Dom




More information about the pmwiki-users mailing list