Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO - vB4] Sidebar in your own mod
Coroner
Join Date: Feb 2008
Posts: 797

I start for about 25 years with an TI and learned Basic. Next was an Commodere 64, Amiga. On Amiga I learned Assembler and wrote some Games. Many years later again, I learned myself (without book ...) php,html and javascript. Then I wrote some small

Germany
Show Printable Version Email this Page Subscription
Coroner Coroner is offline 02-18-2010, 10:00 PM

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>
and add above:
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>
next search for:
Code:
{vb:raw header}
{vb:raw navbar}
and add below:
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>
and at least, search for:
Code:
{vb:raw footer}
and add above:
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>
3.) preparing you're php file(s). Somewhere in you file you're requireing the global.php.
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;
	}
}
This is the original vBulletin Script. That means, the sidebar is always enabled, when the sidebar is enabled in the AdminCP.
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)))
into:
Code:
if ($sidebar_in_my_mod AND $vbulletin->options['enablesidebar'] AND !(is_browser('ie') AND !is_browser('ie', 7)))
$sidebar_in_my_mod could be a value taken from you're mod (eg. $vbulletin->options['xyz']).

Now the last step. Somewhere you have to register your "main" template, simply insert
Code:
$templater->register('sidebar', $sidebar);
We're finish now. You will see the sidebar in you own modification.

Remember: This will show all availiable blocks.
You can use this mod to set the block on page ....
https://vborg.vbsupport.ru/showthread.php?t=235219

I hope this article is helpfull.

Coroner
Reply With Quote
  #2  
Old 03-07-2010, 12:02 PM
abdobasha2004's Avatar
abdobasha2004 abdobasha2004 is offline
 
Join Date: Aug 2008
Posts: 541
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you
nice !
Reply With Quote
  #3  
Old 03-15-2010, 10:32 PM
omardealo's Avatar
omardealo omardealo is offline
 
Join Date: Nov 2008
Location: egypt
Posts: 235
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thnx
working good
http://www.7-secret.org/page.php?do=1&language=en
http://www.7-secret.org/page.php?do=2&language=en
http://www.7-secret.org/page.php?do=3&language=en
http://www.7-secret.org/page.php?do=4&language=en
http://www.7-secret.org/page.php?do=5&language=en
Reply With Quote
  #4  
Old 04-02-2010, 06:26 PM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This isn't working for me... at all. I get the small arrow tab, but it shows on the bottom of my page... instead of on the right... and if I click the arrow, nothing shows up. Below is my page... I cut and pasted the contents directly into it for testing purposes...

Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
  {vb:raw headinclude}
  <link rel="stylesheet" type="text/css" href="{vb:raw vbcsspath}album.css" />
  <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
  {vb:raw headinclude_bottom}

<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>

</head>
<body>
  {vb:raw header}
  {vb:raw navbar}

<vb:if condition="$show['sidebar']">
  <div id="content_container"<vb:if condition="$vboptions['sidebarposition'] == 0"> class="contentright"</vb:if>>
  <div id="content">
</vb:if>

  <div class="block">
    <h2 class="blockhead">Most Recent Media</h2>
    <div class="blockbody floatcontainer">
      <ul id="mediacontainer" style="padding: 20px 0px 0px 0px; text-align: center;">
        <li style="-webkit-box-shadow: #C8C8C8 -2px 2px 2px; background: white none; border: 1px solid #E9E9E9; display: block; float: left; padding: 20px; margin: 0px 0px 20px 20px; width: 400px;"> 
          <div style="padding-bottom: 10px;">
            <b><a href="media.php?do=details&amp;mid=7">Soulcalibur IV: Ending Compilation 3</a></b>
          </div> 
          <div style="float:left; position: relative;"> 
            <span style="position:absolute; bottom:3px; right:3px; font-size:12px; color:#FFFFFF; background-color:#000000; padding:2px;"><b>10:36</b></span> 
            <a href="media.php?do=details&amp;mid=7"><img src="customVID/1/_SCipTB-7gI.jpg" border="0" alt="Soulcalibur IV: Ending Compilation 3" height="106" /></a> 
          </div> 
          <div> 
            03/28/2010 at <span class="time">09:46 PM</span><br /> 
            Uploaded by <a href="media.php?do=user&amp;uid=1">Jaxel</a><br /> 
            <br /> 
            <img src="images/rating/rating-trans-15_0.png" alt="Rating: 0" /><br /> 
            <br /> 
            <a href="media.php?do=category&amp;cid=1">Intros/Cutscenes</a><br /> 
            Views: 16 - Comments: 0
          </div> 
        </li>

      </ul>
    </div>
  </div>

<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>

  <div style="text-align: center;">
    SpyGlass Media Library &copy; Jason Axelrod from <a href="http://www.8wayrun.com/">8WayRun.Com</a>
  </div>

  {vb:raw footer}
</body>
</html>

Code:
require_once('./global.php');

// 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;
	}
}
--------------- Added [DATE]1270277348[/DATE] at [TIME]1270277348[/TIME] ---------------

Okay... I got it working... but it doesn't align correctly...

http://test.8wayrun.com/media.php?
Reply With Quote
  #5  
Old 04-03-2010, 06:55 AM
Coroner Coroner is offline
 
Join Date: Feb 2008
Location: Germany
Posts: 797
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What do you mean with: "align correctely" ? I see your bar on the right.
Reply With Quote
  #6  
Old 04-04-2010, 01:23 AM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The TOP of the sidebar is not lined up with the TOP of my main content...
Reply With Quote
  #7  
Old 04-04-2010, 01:44 AM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Jaxel View Post
The TOP of the sidebar is not lined up with the TOP of my main content...
Tinker with the CSS

You can wrap the entire DIV for the sidebar with a simple:

<div style="margin: -4px 0px 0px 0px;">
All that code up above here blah blah
</div>

to test then modify the original css to suit and remove the div style wrapper.
Reply With Quote
  #8  
Old 04-05-2010, 04:18 AM
Jaxel Jaxel is offline
 
Join Date: Sep 2005
Posts: 1,160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, I don't know why I didn't think of that. I've been programming nonstop for a week... so your brain starts to short out after a while.

Any word on how to add this kind of sidebar functionality to my own sidebar? Not the VB Sidebar?
Reply With Quote
  #9  
Old 05-10-2010, 05:29 PM
Da-Vinci Da-Vinci is offline
 
Join Date: Mar 2010
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Jaxel View Post
This isn't working for me... at all. I get the small arrow tab, but it shows on the bottom of my page... instead of on the right... and if I click the arrow, nothing shows up. Below is my page... I cut and pasted the contents directly into it for testing purposes...

How did you manage to get it working?

I'm having the same issue.
Reply With Quote
  #10  
Old 05-24-2012, 05:58 PM
Bisha's Avatar
Bisha Bisha is offline
 
Join Date: Mar 2006
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it want work on activity.php :S
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:20 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06153 seconds
  • Memory Usage 2,310KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (12)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete