![]() |
[AJAX] Tab Menu For Forum Home
Okay so this is my first contribution to Vbulletin fans. I'm not a coder but I know a little bit about PHP and Javascripts.
After installing the Tabbed Forum Home by bobster65 here (well done, bobster65!) I decided to make a similar mode using Ajax because I want to reduce the initial load of the forum. So basically this mod will apprear almost exactly the same as bobster65's mod but the way it works is totally different. Since this is the beta version which I spent around 2 hours to code and test, please don't expect too much :D Because I don't know much about coding, I will not be able to make this mod become a product. Probably someone else better than me can do this. Update: 25/06/08 - Version 1.3: Fix problem with category's description and category ID on tabs_forumbits template. Remember to update tabs_forumbits template and replace old tabs.php by new tabs.php. 09/06/2008 - Version 1.2: Fix problem with loading default tab initially when member access index.php. Now can load as many categories as you want. 01 new template is created. For whom is using older version, when upgrading to 1.2, please update all new template contents as below. 07/06/2008 - Version 1.1: I found problem with restricted forum so I updated the code to fix this problem. Please make sure you have latest version. 07/06/2008 - Version 1.0: I have revised the code on the tab menu to make it simple to config the tab. I added some codes to set the selected tab. ================================================== ==== LET'S START ================================================== ==== 1/ Upload the tabs.js to folder clientscript (i.e: www.yourdomain.com/forum/clientscript/tabs.js) 2/ Upload the tabs.css and 2 gif images to folder clientscript/vbulletin_css/ (i.e: http://www.yourdomain.com/forum/clie...n_css/tabs.css) 3/ Upload tabs.php to your forum root (i.e: www.yourdomain.com/forum/tabs.php) 4/ Go to your Admin CP and create a new child style from your current style. 5/ On the new style your have just created, from the Template Options, choose "Add New Template" and name it tabs_forumhome. Copy the below code and paste to the Template section and submit: Code:
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> Code:
<tbody> Code:
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="70%" align="center"> Add this code between <head> and </head> Code:
<script type="text/javascript" src="clientscript/tabs.js"></script> New code update 07/06/2008 Code:
<!-- Tab menu by NsT @ RCHobby365 --> Code:
onLoad="startLoad();" Code:
<body onLoad="startLoad();"> Note: You MUST define a specific tab you want to load initially (this will load a specific tab when user access default url such as: forum/index.php). To do this, you need to enter the value (ID) of the hidden input: <input type="hidden" value="1" id="defaulttab"> Now the value="1" so it will load category ID=1 if member go to your index.php page. If you want to load several categories, you need to add the category ID into a string seperate by |. For example: value="1|3" and this will load category 1 and 3. You MUST also have a tab that loads category 1 and 3 or the mod wont work and you will receive an Javascript error. Exampe: <li><a href="#1|3" id="a1|3"><span id="s1|3">Category 1</span></a></li> <li><a href="#1" id="a1"><span id="s1">Category 1</span></a></li> If you want a tab to list a single category with its sub-forums, on the href you just need to enter the category ID after the #: For example: href="#1" will list Category ID=1 and its sub-forums. If you want a tab to list multiple category with their sub-forums, you need to enter a string of categories ID. For example: href="#3|4" will list Category ID=3 and ID=4 with their sub-forums. You can list as many categories as you want, just add their ID into the string, seperate by "|" and this string must be after the #. The ID of <a> and <span> tag is used to define the selected tab. The ID is given by the ID of a single category or multiple category with "|". ID of <a> tag starts with "a" and ID of <span> tag starts with "s". To load all category like normal, you can use this tab: <li><a href="#all" id="aall"><span id="sall">View All</span> </a></li> And that's it :D Hope you will like it and work together to make it better. Credits: - Vbulletin functions - bobster65 for his idea about the tabbed forum. - Css tab menu by www.exploding-boy.com/images/cssmenus/menus.html |
All comments, errors & bugs reports are greatly appreciated!
I forgot to write on the 1st post that: You still can use Bookmark, Back and Forward button on Firefox browser, but with IE, you can only use Bookmark. It seems IE doesn't store location after # into its history. I will need to work a bit more to fix this :D Screenshot: https://vborg.vbsupport.ru/external/2008/06/11.gif |
This is VERY nice thanks.
installed! |
Thanks for your support, please let me know if you feel your forum loads faster?
|
This looks like a great mod and I think I'll install it. :)
|
I just updated a revised version of the tab menu code to make it simpler to config the tabs and add some more code to set the selected tab as the screenshot below:
https://vborg.vbsupport.ru/external/2008/06/10.gif Cheers |
Great hack. The code is also SE friendly which makes it even better
There are more free menus available at exploding boy's site http://exploding-boy.com/images/cssmenus/menus.html http://exploding-boy.com/images/cssmenus2/menus.html Find you best match and apply this hack |
Works well in FF, but I am getting the following error in IE7....
https://vborg.vbsupport.ru/external/2008/06/58.jpg And the tabs don't work :( |
Great mod
Thanks |
@ GamerGirl27: I checked your source code and everything seems right, I don't see why it doesn't work with default URL. I'll try to see what's happening.
Can you try to set to a different initial category? For example your category 17. Let see if it works? |
Quote:
Ok initially I had it set for a few categories for default, now I have just reduced to the one. But its still doing the same thing, unfortunately :confused: Thanks for your help though, and quick response :D Look forward to getting this working as its just what we need atm!! Cheers, Nikki :) |
Hi GamerGirl27,
Sorry that I didn't mention on the 1st post that the initial ID must be the same as one of your tabs ID. It means you can only load a specific tab initially. I see that you reduce the ID string to 3, however, this is not correct because you don't have any <a> and <span> tag with ID=3. Can you replace 3 by 17? It's the ID of "State Groups & Events" category. Let see how it works. |
Thanks for this nice hack, but ... the hack is not working, if Javascript is off.
If no Javascript is activated, it should fallback to the normal behaviour. There are so much AJAX hacks around here, but all not really usable, because the most of the programmer are not thinking about Non-Javascript user. :( |
Thanks for your comment. Probably in the next version I'll make it workable when Javascript is disable.
In fact, from my experience, 99% of my members use default browser settings and most of them don't know how to disable Javascript. So this mod is okay. I believe disable Javascript is only for people know pretty much about IT and for security reason, Javascript is disable :D |
Javascript is first disabled for most of the visited sites, because I hate all the popups on many sites. :( If i can trust a site/forum, I'll activate javascript for this site.
For example, see your demo link without Jajvascript. Without javascript, no forums viewable.:( Kind Regards, Stoebi |
I like the idea NsT!
I've installed and come across some problems. As mentioned, if more than one category is selected for the default, it won't load. Maybe setting the system not to work off the IDs (perhaps giving them unique ones) with a seperate variable that allows you to set what categories are installed might help this problem. I've also noticed that in IE7 when you load up a tab that has restricted access (this might apply to FF2, I'm not sure yet), for example the Admin Category areas, Moderators forums, etc, the category header loads, as if it's bypassing the check in vBulletin that allows a category to be shown or not. This isn't ideal because I'd like to be able to set a tab to show all the forums that are available, not just a select few. And at the same time not show there are restricted areas to my users, as most will never have a need to know they are there. This also makes me wonder if it's possible to set a tab to hold the restricted access areas and have it not show up to users without the permissions to see the area. Also, when you do set the first category to be restricted access in IE7 at least, it loads up the 'no permissions' page within the FORUMHOME template, as opposed to replacing it. Hope this helps you in the development of a nice little mod. |
Hello Mokonzi,
Thanks for your support. I'll spend my time on fixing that problem asap. Since I'm not a coder so I'm not really sure I can do it :D That's why on the Mod Settings, I set this mod to be re-usable so that other coders can develop it if they wish. About the default category, this won't load probably because you don't have a tab for that category. It means you can only load a specific tab as default when user hit index.php. If you just enter an ID of a category, then sure that it won't load :D So for example, if you have 3 tabs: Tab 1, Tab 2, Tab 3. Tab1: href="#1|2" Tab2: href="#3" Tab3: href="#4" If Tab 1 is selected for default, then the startLoad() should take Tab 1 URL: startLoad('1|2') and so on for other tabs. |
I've just updated the code. Now there is a message for restricted forum in stead of showing the forum :D or showing the whole login page with header, navigation, footer, etc.
https://vborg.vbsupport.ru/external/2008/06/9.gif @ Mokonzi: Can you try this and give me your feedback?:D |
I'll give it a try first thing in the morning.
Regarding the default tab, I have been setting that in the startload() section. If it has a single number in, then it loads that tab, but once it has more than one number ("1|2" for example), then it fails to load anything. I'm thinking it doesn't like the | character. Will post back on the new update in the morning. |
If U need TAB SETS goto .....>>>>>>>>>> Custom SeTs <<<<<<<<<< *** TAB CiTY ***
|
The demo link isn't working dude!
|
well, someone DDOS my site and the server is down now :(
|
We are running the AJAX version of bobster65's tab mod...maybe instead of creating a new mod that does the same thing, you two can work together???
|
NsT, I've tried the changes, and so far no difference from before. It's not loading the restricted access section at all, doing the same as last night (tested in IE7).
I noticed you've labeled the section between <!-- main --> and <!-- /main --> as updated. The coding is exactly the same as it was before. I can't see how it's pulling in the updated info if there's a log in clash. xtremeoff-road has a good suggestion there as the two of you working together might be able to smooth out the bumps in the road, so to speak. If this could be set as proper product then it would make the install process a lot easier. I'm happy to help with the development testing as much as I can. :) |
@ xtremeoff-road: Oh bobster65's tab mod is not yet Ajax. It loads all tabs initially and show tab's contents when you click. Also this can not update new posts on all tabs.
The reason I build mine is because I don't want to load all tabs at the begining and I want it to be able to update new posts. Bobster65's PM me yesterday and he was not happy with my mod as he considered me stealing his original idea :| I renamed the mod so that it will be different with Bobster65's mod. Well, I don't want to argue, don't want to fight, probably I will ask Moderator to delete this mod! Mokonzi, well, it's weird because as you can see from my sceenshot on the post above, restricted forum requires login. Can you tell me what kind of yours restricted forum? I mean what permission require to access that forum? I will try to setup a forum like yours and test ;) P.s: my server is not yet up, still down, it was attacked by DDoS just after I posted the mod here, what a coincidence :( |
xtremeoff-road might mean he's got an advanced beta version of the tabs, bobster has mentioned something in his thread about beta testing it.
I'll explain the areas I have restricted access. Some categories are for forums that are under development. They are related to a project that isn't yet public, so they shouldn't be displayed as the forum is set to not be displayed on the index page. Then we have an admin section, where the access is restricted to certain usergroups, moderators, admins, etc. So in theory the other usergroups shouldn't even see the category heading. Edit: I realised that you changed the file download name, and so I'd uploaded the wrong file. Now it restricts access for every forum in that section if the first forum is unauthorized. Suggestions:
|
Oh ok I see, I didn't read the whole thread of Bobster65's mod.
But from my forum, I have these results: Category 1 --- Forum 1 --- Forum 2 (restricted forum, only Admin and Mode can see) --- Forum 3 Category 2 (restricted category, guest can not view) --- Forum 4 --- Forum 5 --- Forum 6 And it works fine on my mode. I and my moderators can see Forum 2 but member can not see it, they only see Forum 1 & 3 when clicking on the tab of Category 1. Guests when clicking on tab of Category 2, a login page appears. Anyway, as soon as my forum is up, I'll test and let you know the more results. |
Ok, I'll illustrate my forums structure, as it's similar but not identical to yours:
Tab 1 is a mix, some of which are category based restrictions. Atm the code shows the category header (wrongly cos vB wouldn't do as standard), but rightly doesn't show the forums. Tab 2 is ideally Admin only, and it'd be nice to allow that only to be visible to admins. I hope that makes some sort of sense. :) |
Yes I have the BETA ajax version of his hack :)
|
Really? How's it compare to this mod? Since I'm not a coder I think I can't work with Bobster65. I just know a little bit about PHP and Javascript :D Not good enough to release a product.
|
I am not able to view the demo at the demo site.
|
Sorry my site just got DDoS attacked so demo will be available tomorrow :(
|
Sorry, just read few threads back. Didn't know you got DDos (only script kiddies do such thing). Anyway, I heard that BBob is working on an Ajax version for his Tab. It'd be nice if you two work together. I'd wait for the final product either from you, or him, or both.
It'd also so nice that if one of you can intergrate the new ajax mod to upgrade the current hack automatically. Otherwise, we might have to uninstall/revert the modified template, reinstall the style and install the ajax hack... |
You need to check location.hash every half a second or so for it to work in IE. I have stumbled upon the same problem some while ago (not in a vbulletin project) and I can guarantee you that this is the only solution, sadly.
Btw why do you use your own tabs.js file and not vB_TabCtrl.js? vBulletin has a built-in tabs system at the moment, that nobody seems to be aware of or use, I don't know why :confused: |
09/06/2008: Released ver 1.2. Fix problem with default tab to load initially when member access index.php. This enable you to load multiple categories initially.
@GamerGirl27 & Mokonzi: Now you can load as many categories as you want :D @ rapidphim: The demo is available to view now :D Well, for me to make this mod become a product to install/uninstall automatically is almost imposible :D because I didn't know much about PHP, especially Vbb installing codes. This is the reason why I marked this mod as "Re-usable" so that someone else better than me can improve it if they wish to. @ Michelle: Oh if you check my tabs.js file, you will see I set an interval to check the URL, but the problem is IE doesn't store link after # into its history so at this moment you can use Back/ Forward buttons. However, you still can use Bookmark and send link to your friends. I'll try to fix Back/ Forward button asap. Believe me I'm newbie in coding so I don't even know that VBB has a vB_TabCtrl.js file :D but anyway, it will be easier for me to code my own file :D |
Oh sorry that I forgot to add the View All tab. This tab will load the whole forum like normal:
<li><a href="#all" id="aall"><span id="sall">Tất Cả</span> </a></li> |
Since installing this I have been getting a number of membrs complaining that they are getting logged out when using the tabs or clicking on mark forums read.
|
Thanks for your feedback. I checked and you are right. However, I found that if you check the "Remember Me" box when logging in, it seems to work fine.
I'll try to fix this problem asap. |
Thanks for the updates so far NsT. I'll have a look at updating it on my test style later.
|
I'm getting this error:
Quote:
|
All times are GMT. The time now is 06:27 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|