Customizing how your site-links are displayed

From e107 Wiki
Jump to: navigation, search

e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page

logo_wiki.png

Current Release 1.0.4 | e107.org | Download | Changelog | Forum | Plugins | Themes | RSS Feed of Latest Changes | Atom Feed of Latest Changes


Theme Development Section of e107 handbook
Main page > I : First Aid > II : Development > III : Administration > IV : How To's > V : Plugin Writing > VI : Theming & Shortcodes


Customizing how your site-links are displayed

The easiest way to customize your sitelinks is to use a function in your theme.php file called function_linkstyle(). See example below.

Here are the parameters that you can use:

  • prelink = the html to use before the links are displayed.


Code: prelink Example
eg. <table> or <div>
  • postlink = the html to use before the links are displayed.


Code: postlink Example
eg. </table> or </div>
  • linkstart = the html used before each link.


Code: linkstart Example
eg. <img src='mybullet.gif' alt='' />
  • linkend = the html used after each link
Code: linkend Example
eg. <br />
  • linkdisplay = the link display mode.
  • linkalign = how the link should be aligned.
  • linkclass = the css class to apply to each link.
  • linkclass_hilite = the css class to apply to the currently selected link


As well as the above, you may also customize your sublinks. They use exactly the same values above, but starting with 'sub'. eg. sublinkstart, sublinkend etc the sublink also includes an additional parameter called subindent which is inserted before sublinkstart.


Code: Customizing how your site-links are displayed
function linkstyle($linkstyle){
    if($linkstyle == "top"){ // top menu (rendertype-2 ie. {SITELINKS=flat:2} )
        $style['prelink'] = "<ul id='mainlevel-nav'>";
        $style['postlink'] = "</ul>";
        $style['linkstart'] = "<li>";
        $style['linkstart_hilite'] = "<li >";
        $style['linkend'] = "</li>";
        $style['linkdisplay'] = 1;
        $style['linkalign'] = "";
        $style['linkclass'] = "mainlevel-nav";
    }else{       // default main menu style.
        $style['prelink'] = "<div style='text-align:left'>";
        $style['postlink'] = "</div>";
        $style['linkstart'] = "";
        $style['linkstart_hilite'] = "";
        $style['linkend'] = "<br />";
        $style['linkdisplay'] = 1;
        $style['linkalign'] = "left";
        $style['linkclass'] = "mainlevel";
        $style['linkclass_hilite'] = "mainlevel-hilite";
        $style['subindent'] = "  >>";
    }
return $style;
}