[pmwiki-users] Re: Wikified action lists

V.Krishn mistyfire at autograf.pl
Wed Aug 3 19:49:22 CDT 2005


> >         
> > 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
ah.... I apparently messed up with the variable scope. 
Following should work.

// ====================
global $ActiveCmdFmt; 
// you may also need to global $isBrowseActive... etc.
$ActiveCmdFmt = array(
 browse => "isBrowseActive",
 edit => "isEditActive",
 diff => "isDiffActive");
// ....and so on for other actions

global $action;
$$ActiveCmdFmt[$action] = "id='active'";
// note the double $$
// ====================
Now in any css file insert this:
#active {border-bottom:6px solid yellow;}
// ====================

Though I have not tried but plan to insert it in one of the skins I am 
updating. But hopefully it should work.
V.Krishn




More information about the pmwiki-users mailing list