[HOW TO - vB4] Sidebar in your own mod
by
19 Feb 2010
Do you like the sidebar ? Here I will explain how to insert it into your own mod. 1.) make sure that you have loaded forumhome.css. This is nessesary for the blocks. 2.) prepare your template(s) (modify your product). You have to do this for all "main" templates you'd like to insert the sidebar! search for: Code:
</head> Code:
<vb:if condition="$show['sidebar']"> <link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}tagcloud.css" /> <script type="text/javascript" src="{vb:stylevar yuipath}/animation/animation-min.js?v={vb:raw vboptions.simpleversion}"></script> <script type="text/javascript"> var sidebar_align = '<vb:if condition="$vboptions['sidebarposition'] == 0">left<vb:else />right</vb:if>'; var content_container_margin = parseInt('{vb:math {vb:stylevar forum_sidebar_width}+{vb:math {vb:stylevar padding}*2}}'); var sidebar_width = parseInt('{vb:stylevar forum_sidebar_width}'); </script> <script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/vbulletin-sidebar.js?v={vb:raw vboptions.simpleversion}"></script> </vb:if> Code:
{vb:raw header} {vb:raw navbar} Code:
<vb:if condition="$show['sidebar']"> <div id="content_container"<vb:if condition="$vboptions['sidebarposition'] == 0"> class="contentright"</vb:if>> <div id="content"> </vb:if> Code:
{vb:raw footer} Code:
<vb:if condition="$show['sidebar']"> </div> </div> <div id="sidebar_container"<vb:if condition="$vboptions['sidebarposition'] == 0"> class="sidebarleft"</vb:if>> <a id="sidebar_button_link" href="#"> <vb:if condition="$vboptions['sidebarposition'] == 0"> <img id="sidebar_button" src="{vb:stylevar imgdir_misc}/tab-collapsed-left.png" alt="" /> <vb:else /> <img id="sidebar_button" src="{vb:stylevar imgdir_misc}/tab-collapsed.png" alt="" /> </vb:if> </a> <ul id="sidebar"> {vb:raw sidebar} </ul> </div> </vb:if> Below it you can insert the following script: Code:
// sidebar $show['sidebar'] = false; if ($vbulletin->options['enablesidebar'] AND !(is_browser('ie') AND !is_browser('ie', 7))) { require_once (DIR . '/includes/class_block.php'); $blockmanager = vB_BlockManager::create($vbulletin); $sidebar = $blockmanager->getSidebarHTML(); if ($sidebar) { $show['sidebar'] = true; } } If you like to change that, simply change the following line: Code:
if ($vbulletin->options['enablesidebar'] AND !(is_browser('ie') AND !is_browser('ie', 7))) Code:
if ($sidebar_in_my_mod AND $vbulletin->options['enablesidebar'] AND !(is_browser('ie') AND !is_browser('ie', 7))) Now the last step. Somewhere you have to register your "main" template, simply insert Code:
$templater->register('sidebar', $sidebar); Remember: This will show all availiable blocks. You can use this mod to set the block on page .... Blocks on Page XXX I hope this article is helpfull. Coroner |
Similar Mods
vB3 Sidebar | vBulletin 3.0 Template Modifications |