[pmwiki-users] Wikified action lists

V.Krishn mistyfire at autograf.pl
Wed Aug 3 13:50:58 CDT 2005


> On Wednesday 03 August 2005 14:22, pmwiki-users-request at pmichaud.com wrote:
> > I'll work on this one.  I know it can be done w/o too much
> > difficulty.
>
> That's great!  Please make whatever solution you come up with usable
> from a CSS file, rather than the template?
>
> With the markup
>
>         (:if auth edit:)
>         * %item class=browse% [[{$Name}?action=browse | $[Read Page]]]
>         * %item class=edit% [[{$Name}?action=edit | $[Edit Page]]]
>         * %item class=diff% [[{$Name}?action=diff | $[Page History]]]
>         * %item class=upload% (:if auth upload:) [[{$Name}?action=upload |
> $[Attach file]]]
>         * %item class=attr% (:if auth attr:) [[{$Name}?action=attr |
> $[Change Attributes]]]
>         (:ifend:)
>
> You can use this CSS rule to mark the current action
>
>         li.$action a {border-bottom:6px solid yellow;}
This is possible perhaps if we make the css files as php - pukka_float 
introduced it ;-)
or if css styles are pumped into html using $HTMLStylesFmt[].
>         
> But only if that CSS rule is in the template file.  I really really
> want to mark the current action using a rule that is stored in a CSS
There a several other ways to do it. I think this mostly depends on the skin 
you are using.

I have tried to put below a way that would work entirely with css.
This is in relation to the default skin "pmwiki"

Since the <a> tags do not have any class or ids we just add a variable next to 
it.

  <td id='wikicmds'>
    <a $isRCActive href='$ScriptUrl/$[$Group/RecentChanges]'
      accesskey='$[ak_recentchanges]'>$[Recent Changes]</a>
    <a $isPrintActive href='$PageUrl?action=print' target='_blank'>$[Printable 
View]</a>
    <a $isDiffActive href='$PageUrl?action=diff'
       accesskey='$[ak_history]'>$[Page History]</a>
    <a $isEditActive href='$PageUrl?action=edit'
            accesskey='$[ak_edit]'>$[Edit Page]</a>
     </td>

Now we define an array. This can be a recipe or in skin.php file.

$ActiveCmdFmt = array(
 browse => "\$isBrowseActive", 
 edit => "\$isEditActive",
 diff => "\$isDiffActive");
// ....and so on for other actions

global $action;
$ActiveCmdFmt[$action] = "id='active'";

Now in an css file insert this:
#active {border-bottom:6px solid yellow;}

I hope this is giving a fair idea.
For other pages like "RecentChanges" this would not work 
(we have to use something like this).

$mygroup = FmtPageName('$Group', $pagename);
if $pagename = ("$mygoup".'RecentChanges') {$isRCActive = "id='active'"};

Similarily it could be done for other pages.

> file that is linked or imported from the template, rather than
> embedded in it.
>
> Bronwyn
V.Krishn




More information about the pmwiki-users mailing list