[pmwiki-users] Conditional markup question
Sandy
sandy at onebit.ca
Tue Jan 22 13:47:47 CST 2008
Jan Erik Moström wrote:
> Second question for today: I'm creating my own skin and I want
> to have a conditional markup, I only want to see the page
> actions if I'm logged in. I looked at the ConditionalMarkup page
> and as far as I understand I should be able to write
>
> (:if authid:)
> <!--PageActionsFmt-->
> <!--wiki:$SiteGroup.PageActions-->
> (:ifend:)
>
> in my template file. But I'm doing something wrong since this
> gives me
>
> (:if authid:)
> + View
> + Edit
> + History
> + Print
> (:ifend:)
>
> So I'm obviously missing something, but what?
You're mixing your languages. The (:if:) directive goes in the
wiki-code, not the .tmpl. The .tmpl is HTML (with CSS); I'm not sure if
you can put PHP in it or not.
Here's the code I put in Site.SideBar.
(:if authid:)
User: {$AuthId}
[[{*$FullName}?action=logout|Logout]]\\
(:if auth edit:)
[[{*$FullName}?action=edit|Edit]]\\
(:if auth admin:)
[[{*$FullName}?action=attr|Page Attributes]]\\
[[Site.Site|Site Admin]]
(:if:)
I'm forever thinking I'm logged in as someone else, hence
User: {$AuthId}
I don't use PageActions at all, although I suppose you could do
(:if authid:)
(:include Site.PageActions:)
(:if:)
Cheers!
Sandy
More information about the pmwiki-users
mailing list