Webbers Corner

Full Version: Adding a sidebar in MyBB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Duration: 10-20 minutes depending on your html skills.

Overview: Will add a sidebar to your index page of your default MyBB theme.  If you want to add it to other themes it should be quite easily adapted.

Full Tutorial:

for the default theme of MyBB.

go to templates > modify/delete > default templates > index page templates > index.
you will see this:

Code:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
{$forums}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<thead>
<tr>
<td class="thead">
<div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['boardstats']}.gif" id="boardstats_img" class="expander" alt="[-]" /></div>
<div><strong>{$lang->boardstats}</strong></div>
</td>
</tr>
</thead>
<tbody style="{$collapsed['boardstats_e']}" id="boardstats_e">
{$whosonline}
{$birthdays}
{$forumstats}
</tbody>
</table>
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1">
<table width="100%">
<tr>
<td>
<img src="{$theme['imgdir']}/on.gif" alt="{$lang->new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /> <span class="smalltext">{$lang->new_posts}</span><br />
<img src="{$theme['imgdir']}/off.gif" alt="{$lang->no_new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /> <span class="smalltext">{$lang->no_new_posts}</span><br />
<img src="{$theme['imgdir']}/offlock.gif" alt="{$lang->forum_locked}" style="vertical-align: middle;" /> <span class="smalltext">{$lang->forum_locked}</span>
</td>
<td style="vertical-align: top; text-align: right;"><span class="smalltext">{$logoutlink}<a href="misc.php?action=markread">{$lang->markread}</a> | <a href="showteam.php">{$lang->forumteam}</a> | <a href="stats.php">{$lang->forumstats}</a></span>
{$loginform}
</td>
</tr>
</table>
</td>
</tr>
</table>
{$footer}
</body>
</html>


if you copy this into dreamweaver or something you can just copy put a table around the forums.  like this:

Code:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top">{$forums}
      <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
        <thead>
          <tr>
            <td class="thead"><div class="expcolimage"><img src="{$theme['imgdir']}/collapse{$collapsedimg['boardstats']}.gif" id="boardstats_img" class="expander" alt="[-]" /></div>
                <div><strong>{$lang-&gt;boardstats}</strong></div></td>
          </tr>
        </thead>
        <tbody style="{$collapsed['boardstats_e']}" id="boardstats_e">
        </tbody>
        {$whosonline}
        {$birthdays}
        {$forumstats}
  <tr>
    <td></tbody></td>
  </tr>
      </table>
      <br />
      <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
        <tr>
          <td class="trow1"><table width="100%">
              <tr>
                <td><img src="{$theme['imgdir']}/on.gif" alt="{$lang-&gt;new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /> <span class="smalltext">{$lang-&gt;new_posts}</span><br />
                    <img src="{$theme['imgdir']}/off.gif" alt="{$lang-&gt;no_new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /> <span class="smalltext">{$lang-&gt;no_new_posts}</span><br />
                    <img src="{$theme['imgdir']}/offlock.gif" alt="{$lang-&gt;forum_locked}" style="vertical-align: middle;" /> <span class="smalltext">{$lang-&gt;forum_locked}</span> </td>
                <td style="vertical-align: top; text-align: right;"><span class="smalltext">{$logoutlink}<a href="misc.php?action=markread">{$lang-&gt;markread}</a> | <a href="showteam.php">{$lang-&gt;forumteam}</a> | <a href="stats.php">{$lang-&gt;forumstats}</a></span> {$loginform} </td>
              </tr>
          </table></td>
        </tr>
      </table></td>
    <td width="200" valign="top">sidebar here </td>
  </tr>
</table>
</body>
</html>


this will make a space for the sidebar.  if you want it in the same style as the normal forums like my forum (http://www.webberscorner.com) just add this to the sidebar.

Code:
<table border="0" cellspacing="1" cellpadding="4" width="190px">
<tr>
<td class="thead"><strong>side name</strong></td>
</tr>
<tr>
<td class="trow1">
<span class="smalltext">
<center>
stuff
</center>
</span></td>
</tr>
</table>


that would add a sidebar on the homepage.  i wouldn't advise adding it anywhere else as you have to edit a lot of template files which can get a little messy.

hope this helps.

dave.

Reference URL's