[pmwiki-users] conditional stylesheets

Bronwyn Boltwood arndis at gmail.com
Thu Apr 21 22:30:36 CDT 2005

On 4/21/05, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Thu, Apr 21, 2005 at 09:36:44PM -0400, Bronwyn Boltwood wrote:
> > How can I make PmWiki load the no-authoring stylesheet only when a
> > visitor is NOT authorized to edit pages?
> In 2.0.beta28 and later, the simplest is
>    if (!RetrieveAuthPage($pagename, 'edit', false, READPAGE_CURRENT))
>      $HTMLHeadersFmt[] =
>        '<link rel="stylesheet" href="$SkinDirUrl/css/no-authoring.css" />';

I must be doing something wrong.  I created a skin.php that contains
the following:

<?php if (!defined('PmWiki')) exit();
hide authoring links if not authorized
if (!RetrieveAuthPage($pagename, 'edit', false, READPAGE_CURRENT))
	$HTMLHeadersFmt[] = '<link href="$SkinDirUrl/feature-author-off.css"
media="screen, tv, projection, handheld" rel="stylesheet"
type="text/css" />';

To test it, I deleted PmWiki's cookies in my browser and refreshed the
page.  Although I wasn't logged in, there were still authoring links,
and there's no extra link statement in the HTML source.  I can tell
that I haven't put in an edit-or-greater password because the tiny
"edit this sidebar" link is *not* visible at the bottom of the

Sorry to be a bother.  OTOH, somebody was going to ask this eventually! :)


More information about the pmwiki-users mailing list