![]() |
|
#1
|
|||
|
|||
|
NOTE: Version 2.0 is now available here: http://www.vbadvanced.com/forum/showthread.php?t=23764 This version is still available as an option, but version 2.0 is a much better system. These are 2 totally different systems. 2.0 is NOT an upgrade, its a seperate release.
Hello KW, Raman, Wolf and countless others that have asked about Tabbed Modules and vBadvance, I've received many posts & PMs about how I've implemented tabs within vBadvance, so instead of replying to each one seperately, I went ahead and wrote up this "how to". I hope that its easy to follow along and meets your needs. If you are reading this and wondering what a tabbed module is, check out the attached screen shots. This is what I've done so far to implement Tabs functionality within vBadvance for my websites.... Note: This Module is based of off the Ajax Project - Tabbed Page Interface over at crackajax (http://www.crackajax.net/tabs.php) Module Type: TEMPLATE w/Alternative Module Wrapper Template Templates: adv_portal_Tab_Block, adv_portal_alt_module_wrapper (optional) Files: ahahLib.js, TabAJAX.css, tabcontent.php Download the ahahLib.js file from crackajax.net (http://www.crackajax.net/ahahLib.js) Step 1. Upload the ahahLib.js file. No modifications to this file are needed. The location I chose was the clientscript folder that comes default with your vBulletin installation .. path example /www/forums/clientscript . It doesn't HAVE to go there, I just chose to put it there since its a common place for js files.. Step 2. Create, Name and Upload CSS file. The location I chose was the vbulletin_css folder that comes default with your vBulletin installation. path example /www/forums/clientscript/vbulletin_css . Again, it doesn't HAVE to go there, I just chose to put it there since its a common place for css files. You can name the css file anything you like.. I named mine TabAJAX.css . Note: Modifications to this file can be made once you get the initial sample system up and running. CSS file - Sample Name: TabAJAX.css Code:
pre {text-indent: 30px}
#tabmenu {
color: #000;
border-bottom: 1px solid black;
margin: 12px 0px 0px 0px;
padding: 0px;
z-index: 1;
padding-left: 10px }
#tabmenu li {
display: inline;
overflow: hidden;
list-style-type: none; }
#tabmenu a, a.active {
color: #aaaaaa;
background: #295229;
font: normal 1em verdana, Arial, sans-serif;
border: 1px solid black;
padding: 2px 5px 0px 5px;
margin: 0px;
text-decoration: none;
cursor:hand; }
#tabmenu a.active {
background: #ffffff;
border-bottom: 3px solid #ffffff; }
#tabmenu a:hover {
color: #fff;
background: #ADC09F; }
#tabmenu a:visited {
color: #E8E9BE; }
#tabmenu a.active:hover {
background: #ffffff;
color: #DEDECF; }
#content {font: 0.9em/1.3em verdana, sans-serif;
text-align: justify;
background: #ffffff;
padding: 20px;
border: 1px solid black;
border-top: none;
z-index: 2; }
#content a {
text-decoration: none;
color: #E8E9BE; }
#content a:hover { background: #aaaaaa; }
Note: Modifications to this file can be made once you get the initial system up and running. PHP file - Sample name: tabcontent.php PHP Code:
Alternative Module Wrapper Template - Sample name: adv_portal_alt_module_wrapper Code:
<div style="padding-bottom:$vba_style[portal_vspace]px"> <table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" width="100%"> <tbody id="collapseobj_module_$mods[collapse]" style="$modcollapse"> <if condition="$show['tablerow']"> <tr> <td class="$bgclass"> $modulehtml </td> </tr> <else /> $modulehtml </if> </tbody> </table> </div> Custom Template Sample name: adv_portal_Tab_Block Code:
<tr><td >
<body onload="makeactive(1)">
<link href="http://www.domain.com/forums/clientscript/vbulletin_css/TabAJAX.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="http://www.domain.com/forums/clientscript/ahahLib.js"></script>
<script language="JavaScript" type="text/javascript">
function makeactive(tab) {
document.getElementById("tab1").className = "";
document.getElementById("tab2").className = "";
document.getElementById("tab3").className = "";
document.getElementById("tab"+tab).className = "active";
callAHAH('http://www.domain.com/forums/tabcontent.php?content= '+tab, 'content', 'getting content for tab '+tab+'. Wait...', 'Error');
}
</script>
<ul id="tabmenu" >
<li onclick="makeactive(1)"><a class="" id="tab1">Tab 1</a></li>
<li onclick="makeactive(2)"><a class="" id="tab2">Tab 2</a></li>
<li onclick="makeactive(3)"><a class="" id="tab3">Tab 3</a></li>
</ul>
<div id="content" class="smallfont"></div>
</td></tr>
Path location of the CSS file created in step 2. Simply edit this line in the template to the correct path where you uploaded the CSS File. Code:
<link href="http://www.domain.com/forums/clientscript/vbulletin_css/TabAJAX.css" rel="stylesheet" type="text/css"> Quote:
Code:
callAHAH('http://www.domain.com/forums/content.php?content= '+tab, 'content', 'getting content for tab '+tab+'. Wait...', 'Error');
Code:
<body onload="makeactive(3)"> Step 7. Add the Module . Add the module created in Step 6 above to a page. Step 8. Load the page that you added the module to. If you performed the above steps correctly, the result will be a tabbed block module with 3 tabs named Tab 1, Tab 2, Tab 3. The content for Tab 1 will say "Congrats, Insert Dynamic or Static Code here for Tab 1" CUSTOMIZATION Style: Modify CSS File created in Step 2 to match the Style of your site. Tab Names: Modify Template created in Step 5 to change the NAME of the tabs themselves - ie.. from Tab 1 to Announcements (see below) Code:
<li onclick="makeactive(1)"><a class="" id="tab1">Announcements</a></li> Sample mix of static and dynamic content PHP Code:
ADDING MORE TABS To add more tabs, you will need to modify the template created in Step 5 and the PHP file created in Step 3. Step 1. Add the following 2 lines of code to the Template that you created in Step 5 for each new Tab that you want to appear. Make sure that when you add the lines that you keep them in order with the other lines currently in the file. Code:
document.getElementById("tab4").className = "";
Code:
<li onclick="makeactive(4)"><a class="" id="tab4">Tab 4</a></li> PHP Code:
btw, Sorry for such a long post. I do hope that I explained things well enough to at least get a head start on Tabbed Modules. Let me know if you have any problems or need further explanation on anything... Thanks and enjoy BobEDIT: Added screen shots. The 1st is an example of some dynamic content based on the user. The 2nd is an example of modified recentthreads.php used within a tab. The 3rd is an example of using modified vbarticles within a tab. The 4th and 5th are examples of dynamic content within a tab. Last edited by bobster65; 08-15-2007 at 02:20 PM. Reason: added screen shots/added detailed step by step |
|
#2
|
|||
|
|||
|
Hello bobster65,
Thank you so much for the detail overview. Really appreciate the time you took to prepare this post With Regards Raman Edit: I also got it working, but dynamic content is giving me "Parse error: parse error, unexpected T_STRING, expecting ',' or ';'" at following line in php dynamic content code snippet Quote:
Last edited by Raman; 08-02-2007 at 03:47 AM. |
|
#3
|
|||
|
|||
|
I second Raman. Thank you very much.
![]() Edit: I've gotten the module to display, but for some reason it's not displaying the content.
__________________
Discussion Forum Last edited by wolf32; 08-01-2007 at 08:57 PM. |
|
#4
|
|||
|
|||
|
Quote:
|
|
#5
|
|||
|
|||
|
Hey Wolf.. I sent you a PM. Sounds like its probably a path issue to the content.php within the module template.
|
|
#6
|
|||
|
|||
|
this is pretty nice.. I think I may use this and incorporate it with the slideshow to allow for various categories.. exactly what I was looking for.
__________________
RUOFFICIAL? www.RUOFFICIAL.com COAST 2 COAST ENTERTAINMENT! RATE MY VBADVANCED WEBSITE!!
|
|
#7
|
|||
|
|||
|
Quote:
|
|
#8
|
|||
|
|||
|
Per request, I added a few screen shots to the first post.
|
|
#9
|
|||
|
|||
|
edit*** yeah.. it was the vodka..
got it all straightened out... now its time to add in a lil custom work*
__________________
RUOFFICIAL? www.RUOFFICIAL.com COAST 2 COAST ENTERTAINMENT! RATE MY VBADVANCED WEBSITE!!
Last edited by concepts; 08-03-2007 at 12:30 PM. |
|
#10
|
|||
|
|||
|
Quote:
Hope this makes more sense with or without the Vodka (Im terrible at writing these things).. EDIT: Moved the new Step by Step into the first post to eliviate confusion..... Last edited by bobster65; 08-03-2007 at 04:33 PM. |
|
#11
|
|||
|
|||
|
your a great man! (you are a man right?) I hate assuming! lol... but this is actually a perfectly written tutorial now. Couldn't be more descriptive! I look forward to showing what I have done with this.. by the way.. check your pm.. sending a message now
__________________
RUOFFICIAL? www.RUOFFICIAL.com COAST 2 COAST ENTERTAINMENT! RATE MY VBADVANCED WEBSITE!!
|
|
#12
|
|||
|
|||
|
Quote:
Thank you... since you think its much better, I replaced the first post with the one I wrote for you. Can't wait to see what you come up with! |
|
#13
|
|||
|
|||
|
Quote:
Your reply made me laugh like anything, both of you really got good sense of humorHave a good day Last edited by Raman; 08-03-2007 at 06:08 PM. |
|
#14
|
|||
|
|||
|
There's a small problem with mine. It never loads the content. It says it is loading, but it just sits there... and sits there.... <.<
|
|
#15
|
|||
|
|||
|
Quote:
PHP Code:
Last edited by bobster65; 08-08-2007 at 09:29 AM. Reason: Changed PHP File to TEMPLATE |
|
#16
|
|||
|
|||
|
Quote:
Last edited by jpt62089; 08-07-2007 at 09:29 PM. |
|
#17
|
|||
|
|||
|
Quote:
If you want me to look at your system, let me know. So far, Everyone that has had problems had something in the steps that they didn't follow correctly and I got them up and running in minutes. Its up to you, PM if you are interested. Im more than willing to drop what Im doing to help you out. |
|
#18
|
|||
|
|||
|
I checked out the Error Console in Firefox and it gives me three errors:
Warning: Error in parsing value for property 'curser'. Declaration dropped. Source file: The CSS file Warning: Error in parsing value for property 'float'. Declaration dropped. Source file: Home page URL Warning: Expected declaration but found '$'. Skipped to next declaration. Home page URL And I re-checked all the steps and everything is good. Last edited by jpt62089; 08-08-2007 at 03:34 PM. |
|
#19
|
|||
|
|||
|
Quote:
|
|
#20
|
|||
|
|||
|
Ok, I got it working. It was because VBA is in the main domain area and I had all the files in a sub domain.
Haha Thanks for the help
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Module] [AJAX] vBShout v2.0 | pennylessz28 | Add-On Modules (version 3.x & 2.x) | 115 | 10-10-2009 07:06 PM |
| REQ: AJAX latest post module - will pay | trana | Module & Modification Discussion & Requests | 5 | 12-05-2007 01:43 PM |
| Online Users Module (AJAX version)? | ERuiz | Module & Modification Discussion & Requests | 1 | 07-05-2007 12:54 AM |
| Tabbed Block | 3z3k3l | Module & Modification Discussion & Requests | 8 | 05-25-2007 12:18 PM |
| AJAX module - World Of Warcraft Realm Status module | jim6763nva | "How Do I..." Questions | 10 | 07-28-2006 06:26 PM |