Revision [17547]

This is an old revision of TabsMenu made by AndreasHeintze on 2007-09-28 05:43:39.

 

TabsMenu


This is what you will get:
 (image: http://www.home.no/foof/tabs.jpg)

By adding this piece of code on your pages:
:::[[FirstTab This is the first tab]]::[[SecondTab Second tab]]::@[[ThirdTab Third tab]]::[[LastTab Last tab]]:::

It's the character @ after the double or triple colon that marks the tab as active.

..and here is what you need to add to your wikka system:

In wikka.css add:
/* Action: tab */
.tabline {
    margin: 0px;
    border-bottom: 1px solid #000;
}
.activetab {
    margin: 0px;
    padding-left: 4px;
    padding-right: 4px;
    border-top: 2px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
}
.inactivetab {
    margin: 0px;
    padding-left: 4px;
    padding-right: 4px;
    border: 1px solid #000;
    background-color: #E0E0E0;
}



In wakka.php add this:
  1.         // TabsMenu
  2.         else if (preg_match("/^:::(.*?):::$/s", $thing, $matches))
  3.         {
  4.            
  5.             // Determine if first tab is active or not
  6.             $output = $matches[1];
  7.             if (substr($output, 0 , 1) == '@') {
  8.                 $tabclass = 'activetab';
  9.                 $output = substr($output, 1);
  10.             }
  11.             else {
  12.                 $tabclass = 'inactivetab';
  13.             }
  14.            
  15.             // Fix links or other wiki markup inside tabs
  16.             $output = preg_replace_callback(
  17.             "/(".
  18.             "\"\".*?\"\"|".                                                                         # literal
  19.             "\[\[[^\[]*?\]\]|".                                                                     # forced link
  20.             "\b[a-z]+:\/\/\S+|".                                                                    # URL
  21.             "\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|&pound;&pound;|&yen;&yen;|\+\+|__|<|>|\/\/|".   # Wiki markup
  22.             "======|=====|====|===|==|".                                                            # headings
  23.             "\{\{.*?\}\}|".                                                                         # action
  24.             "\b[A-ZÅÄÖÜ][A-Za-zÅÄÖÜßåäöü]+[:](?![=_])\S*\b|".                                          # InterWiki link
  25.             "\b([A-ZÅÄÖÜ]+[a-zßåäöü]+[A-Z0-9ÅÄÖÜ][A-Za-z0-9ÅÄÖÜßåäöü]*)\b|".                              # CamelWords
  26.             "\n".                                                                                   # new line
  27.             ")/ms", "wakka2callback", $output);
  28.  
  29.             $output = str_replace('::@', '</span><span class="activetab">', $output);
  30.             $output = str_replace('::', '</span><span class="inactivetab">', $output);
  31.            
  32.             return '<span class="tabline">&nbsp;&nbsp;&nbsp;</span><span class="' . $tabclass . '">' . $output . '</span><span class="tabline">&nbsp;&nbsp;&nbsp;</span>';
  33.            
  34.         }


  1.     "/(".
  2.     ":::.*?:::|".                                                                           # TabsMenu  <== just add this line
  3.     <snip>...


What do you think about this? You may include this in the standard code base if you like.

/AndreasHeintze


CodeContributions
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki