[Pmwiki-users] Sidebar Highlighting?

Patrick R. Michaud pmichaud
Fri Oct 1 08:50:26 CDT 2004


On Sun, Sep 26, 2004 at 09:25:40PM +0200, Hochstrasser Benedikt wrote:
> 
> Is there a halfway simple way to highlight the corresponding sidebar
> entry when a page is open? 

Here's a way to do it using CSS in v1.  It's a bit tricky, but worth 
following...

In config.php, set $WikiPageExistsFmt to read

   $WikiPageExistsFmt = "<a class='wikilink,$Group-$Title_' 
      href='\$PageUrl\$Fragment'>\$LinkText</a>";

This causes every wiki link to appear in a CSS class identified by the
pagename, i.e., a link to Main.WikiSandbox would have
class='wikilink,Main-WikiSandbox' in it.  

Next, we just add a line to create a "dynamic" CSS statement
that says how to style links to the current page.

   $HTMLHeaderFmt[] = "<style type='text/css'><!--
     .$Group-$Title_ { color:red; } --></style>";

Thus, if the current page is Main.WikiSandbox, we'll get a CSS statement
that says

      .Main-WikiSandbox { color:red; }

so any HTML element in class "Main-WikiSandbox" (such as the link above)
will automatically be styled in red text.


Or, just use John Rankin's cookbook script that allows one to style
self-referencing wikilinks.  In fact, I'm now officially convinced that
controlling self-referent links deserves its own $...Fmt variable 
(and will make it that way in v2).

Pm



More information about the pmwiki-users mailing list