The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
AJAX Tabs Content Script v2 Details »» | |||||||||||||||||||||||||
AJAX Tabs Content Script - Version 2.0
Note: Altho this "How To" is written for implementation within vbadvanced CMPS, this can also be easily implemented anywhere within vB , ie on custom vB pages or within current vB pages. Description/Whats changed within this release?: This new version (based on the AJAX Tabs Content Script (v 2.0) written by Dynamic Drive - http://www.dynamicdrive.com/dynamici...tent/index.htm) is a versatile Ajax script that lets you display content pulled from external files inside a DIV and organized via CSS tabs. A fully unobtrusive, CSS and HTML based script, it supports practical features such as persistence of the active tab (ie: when page is reloaded), an "IFRAME" mode, a "slideshow" mode, ability to expand/contract arbitrary DIVs on the page at the same time, nested tabs, and much more. Below lists the features of this script that together make it highly adaptable in the real world: Here's a quick outline of the script features:
Reminder: Due to security limitations, the external pages loaded via each tab using Ajax must reside on the same domain as the script itself. This limitation doesn't apply if you use the "IFRAME" option to fetch and show the external page instead. This is what I've done so far to implement AJAX Tabs functionality for my websites and others. I hope that its easy to follow along, answers your questions and meets your needs. If you are reading this and wondering what a tabbed content is, check out the screen shots for a visual. CMPS Version Note: Coded for CMPS v3.0. Modifications can be made to the php files (Require Back-End) to work with CMPS v2.x CMPS Module Type: TEMPLATE w/Alternative Module Wrapper Template Templates: adv_portal_Tab_Block_Main, adv_portal_alt_module_wrapper (optional) Files: ajaxtabs.js, ajaxtabs.css, Sample Content Files, images Note: I've included sample files in the attached Zip File to use with the step by step how to. Step 1. Upload the ajaxtabs directory (located in the attached Zip File) to the FORUMS Root. This directory contains the ajaxtabs.js file & the ajaxtabs.css file path example: /www/forums/ajaxtabs/ajaxtabs.js Step 2. Modify CSS file. Use Attached Sample CSS file - Sample name: ajaxtabs.css Change paths to images to reflect your domain and forum root (2 lines)... Note: Additional Modifications to this file can be made once you get the initial sample system up and running. Step 3. Create, Name and Upload Multiple "Content" files. Use attached Sample PHP "Content" file - Sample name: tabexternal.php (I've included working samples in the attached Zip File). NOTE: Please read the Instructions TXT File for the edits that need to be made in order for them to work on your site. The location I chose for these was the FORUMS root. path example: /www/forums You can name these files anything you want. For example, I chose a naming convention - tabexternal.htm, tabexternal2.php, tabrecentnews.php, tabvbookie.php, ..etc etc Note: Further Modifications to these files can be made once you get the initial system up and running. Step 4. (optional) Create an Alternative Module Wrapper Template. Use attached Sample Alternative Module Wrapper Template - Sample name: adv_portal_alt_module_wrapper I chose to do this, because I didn't want to use the standard Module Wrapper that comes default with vBadvanced. NOTE: Use the default wrapper if you choose not to create your own custom one. Step 5. Create a new Template. Use attached sample Custom Template Sample name: adv_portal_Tab_Block_Main This template will be the one that you include with the module that you will create in Step 6. I've included the code for the sample template in the attached file, HOWEVER, there are some edits that you will need to make to the code based upon steps 1-3 above. EDITS NEEDED TO THE ATTACHED SAMPLE TEMPLATE: EDIT 1 - Path location of the ajaxtabs.css file created in step 2. Simply edit this line in the template to the correct path. Code:
<link rel="stylesheet" type="text/css" href="/forums/ajaxtabs/ajaxtabs.css" /> Code:
<script type="text/javascript" src="/forums/ajaxtabs/ajaxtabs.js"> Code:
<li class="selected"><a href="http://www.domain.com/forums/tabexternal.php" rel="ajaxcontentarea">Tab 1</a></li> <li><a href="http://www.domain.com/forums/tabexternal2.php" rel="ajaxcontentarea">Tab 2</a></li> <li><a href="http://www.domain.com/forums/tabexternal3.php" rel="ajaxcontentarea">Tab 3</a></li> <li><a href="http://www.domain.com/forums/tabexternal4.php" rel="ajaxcontentarea">Tab 4</a></li> Step 6. Create a new CMPS TEMPLATE Module. Name it what ever you like. Include the template that you created in Step 5 above. Make sure that you either use the Module Wrapper Template OR the Alternative Module Wrapper Template that you created in optional Step 4 above. Give permission(s) to the user groups that you want to be able to view this. Step 7. Add the Module to a CMPS page. Add the module created in Step 6 above to any CMPS page (make a test page if you want to)... Step 8. Load the CMPS page that you added the module to. If you performed the above steps correctly, the result will be a tabbed block module with 4 tabs named Tab 1, Tab 2, Tab 3, Tab 4. The content for Tab 1 will say "Congrats USERNAME! You have successfully added AJAX Tab Content to your Site." CUSTOMIZATION Style: Modify CSS File in Step 2 to match the Style of your site. The Sample CSS Files comes with 3 different styles of Tab Layouts. Choose the one that best suits your needs and further modify the CSS to match your sites Style(s).... 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><a href="http://www.domain.com/forums/tabexternal.php" rel="ajaxcontentarea">Announcements</a></li> Content: Modify "Content" File(s) created in Step 3 to generate content. You can add static content or Dynamic Content. Below is a very very basic sample of what can be done. Sample mix of static and dynamic content PHP Code:
Turning on "slideshow" mode You can have the tabs within your Ajax Tabs Content automatically rotate every x seconds until a user explicitly clicks on a tab. To enable "slideshow" mode on your Tab Content, just pass in an integer when calling instance.init() to initialize your script: This is located at the bottom of the Template you created in step 5 Code:
<script type="text/javascript"> var mytabs=new ddajaxtabs("maintab", "ajaxcontentarea") mytabs.setpersist(true) mytabs.setselectedClassTarget("link") //"link" or "linkparent" mytabs.init(15000) </script> </body> </td></tr> ADDING MORE TABS To add more tabs, you will need to modify the template created in Step 5 and create a new "content" file for each new tab (as explained in Step 3). Step 1. Add the following line of code to the Template that you created in Step 5 for each new Tab that you want to appear. Its a good idea when you add the lines that you keep them in order with the other lines currently in the file. Code:
<li><a href="http://www.domain.com/forums/CONTENT FILE" rel="ajaxcontentarea">TAB NAME</a></li> Code:
<li><a href="http://www.domain.com/forums/tabcontent5.php" rel="ajaxcontentarea">Sports News</a></li> Additional Enhancements Please see post 2 of this thread for additional enhancements. If you want to read up on AJAX Tabs, check out the Ajax Tabs Content script over at Dynamic Drive (http://www.dynamicdrive.com/dynamici...tent/index.htm) ....thats it in a nutshell.... I do hope that I explained things well enough to at least get a head start on AJAX Tabbed Content. Let me know if you have any problems or need further explanation on anything... Thanks and enjoy Bobster Screen Shots Explained: The 1st is an example of "Slideshow" Mode The 2nd is an example of some dynamic content based on the user. The 3rd is an example of modified recentthreads.php used within a tab. The 4th is an example of using modified vbarticles within a tab. The 5th is an examples of custom dynamic content within a tab. Show Your Support
|
Comments |
#112
|
||||
|
||||
Quote:
|
#113
|
||||
|
||||
*Update* added two new sample content files for use with this addon as well as a sample make your own file (Replicate the vBa UserCP Block)
The FILES for these are located in Post 3 of this Thread. NEW 02-07-2008 - tabrecentthreadsexp2.php - This file includes Post ICON Column and the ability to set a specific Thread Title Character cut off amount. NEW 02-07-2008 - tab_blog.php - This content file is for use with vbulletins blog system. It is a BASIC recent blogs layout. The File contains 2 Layout Styles (Wide and Small). Wide is the default. To use small (for skinny Tab Layouts) remark out the 2 Wide Layout Areas and uncomment out the 2 ALT Layout Areas. Both display Title, Name, Data and Views. What to make your own? Check out Post 3 of this thread to see an example of replicating the USER CP BLOCK. |
#114
|
|||
|
|||
I apologize, I said I would post up the GARs tab that I completed and I completely forgot. For those of you using GARs for articles on your vBulletin forums, if you would like to display the latest recent GARs articles within an Ajax TAB you can do so with the following .php file:
Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'tabrecentthreadsexp'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); //require_once('./includes/vba_cmps_include_template.php'); require_once('./includes/vba_cmps_global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### ?> <?php echo '<table border="0" cellpadding="0" cellspacing="0" width=100%><tr>'; $modulehtml = ""; $x = 0; $bburl = $vbulletin->options['bburl']; $forumids = ""; // Comma seperated list of forumids $limit = 4; // How many items to show $title = ""; // Module Title $featured = 0; // 1= Only featured items $url_to_default_image = "types/3/default.jpg"; //Relative URL to default image from geek/gars/images/ folder $vertical = 0; // 1= Vertical (only for template 1 or 3) $preview = 1; // 1= Show preview $ratings = 0; // 1=show ratings $template = 2; // 1=simple with pic, 2=big with pic, 3=Listing no pic $order = 1; // 0 = rand, 1=desc, 2=asc $maxchars = 150; // Maximum amount of chards to snip $customfields = false; // Set to true to grab the custom fields. $parsebb = true; //set to true to parse preview switch ($order) { case 0: $order = "RAND()"; break; case 1: $order = "g.threadid DESC"; break; default: $order = "g.threadid ASC"; } if (!$limit) { $limit = "1"; } // COMMENTED OUT FOR TESTING ($hook = vBulletinHook::fetch_hook('vba_cmps_module_recthreads_start')) ? eval($hook) : false; // Main SQL $results = $db->query_read("SELECT g.threadid,g.header_image image, p.title, g.byline" . ($preview ? ", IF(g.synopsis, g.synopsis, p.pagetext) synopsis " : "") . ($ratings ? ",round((g.overall_rating/10),0) author_rating, g.overall_rating author_rating_percent,round((g.avg_rating/10),0) member_rating, g.avg_rating member_rating_percent " : "" ) . ",g.pagecount, g.custom2 $customfields FROM " . TABLE_PREFIX . "gars g " . ($customfields ? " INNER JOIN " . TABLE_PREFIX . "gars_custom_values gsv ON gcv.custom_threadid = g.threadid " : "") . " INNER JOIN " . TABLE_PREFIX . "thread t ON g.threadid = t.threadid INNER JOIN " . TABLE_PREFIX . "post p ON t.firstpostid = p.postid WHERE t.visible = 1 AND t.open != 10 " . ($forumids ? " AND t.forumid in ($forumids) " : "" ) . " " . ($featured ? " AND g.feature_untill> " . TIMENOW : "") . " ORDER BY $order LIMIT $limit"); while ($result = $db->fetch_array($results)) { if (!$result['image']) { $result['image'] = $vbulletin->options['bburl'] . "/geek/gars/images/" . $url_to_default_image; } elseif (substr($result['image'], 0, 1) == ".") { $result['image'] = $vbulletin->options['bburl'] . substr($result['image'], 1); } else { $result['image'] = $vbulletin->options['bburl'] . $result['image']; } if ($parsebb && $template!=3) { $result['message'] = strip_bbcode($result['synopsis']); } if (strlen($result['message']) > $maxchars) { $result['message'] = substr($result['message'], 0, strrpos(substr($result['message'], 0, $maxchars), ' ')) . '...' . ($template!=3 ? construct_phrase($vbphrase['read_more'], $vbulletin->options['bburl'], $result['threadid'], $session['sessionurl']) : ""); } if (strlen($result['message']) > $maxchars) { $result['message'] = substr($result['message'], 0, strrpos(substr($result['message'], 0, $maxchars), ' ')) . '...' . ($template!=3 ? construct_phrase($vbphrase['read_more'], $vbulletin->options['bburl'], $result['threadid'], $session['sessionurl']) : ""); } eval('$bits = "' . fetch_template('adv_portal_gars_bit' . $template) . '";'); echo '<tr>' . $bits . '</tr>'; } echo "</table>"; ?> I hope this helps anyone using GARs and the Ajax TABs script. You can see this running live at my website (www.ready-up.com). There is currently a small bug in firefox with my nested tabs, just hit the "Home" link on the top of the page if you are using firefox and you should be able to see the tabs working perfectly after that. PM me if you have any questions or problems setting that up. Thanks again bob, wonderful script! |
#115
|
||||
|
||||
Quote:
Each file comes with various configuration settings to meet your needs/requirements.. ie $linkurl Variable (The full URL Path to your vba links directory) $order Variable can be set as follows (1 = newest, 2 = most viewed, 3 = most comments, 4 = highest rated, 5 = random) to give you 5 different ways of displaying your data for your members. $limit Variable can be set to the number of links you would like to display $maxnamechars Variable used to set the max characters of the links name before the rest will be replaced with '...' NOTE: Set this to 0 to disable it. Both files contain the same basic code, just different echo output to control the Layout for the Data. To further customize the layout, look for the echo statements and edit the HTML output.. simple as that |
#116
|
|||
|
|||
This is an mazing hack I have ever seen, thank you for your time to code. I have a little request, I just want to make a simple tab category for different categories in a forum like the picture shown, say I click on announcement tab it only pulls out the threads about announcement, click on recent NFL news it shows only thoses threads of NFL news. Can somone show me how, the more I read on the post the more I confuse... Thank you in advance... |
#117
|
||||
|
||||
Quote:
|
#118
|
||||
|
||||
bobster, I just wanted to say thanks for all of your work on this. Your support is nothing less than superb and you deserve a lot of credit. I installed it on my site this morning and it's working great!
|
#119
|
||||
|
||||
You are more than welcome Eric. If you have any questions, feel free to PM me anytime.
|
#120
|
|||
|
|||
hello bobster,
first: a hudge thank you for this work I see in dynamic drive page a new js version. We can update in our installs? The new version have a interesting feature [forward/reward] tabs All the best Joao Barroca aka beduino |
#121
|
||||
|
||||
Quote:
I'll check things out :up: EDIT: OK, checked it out. Nothing major, just a .(dot) release. All you need to do is upload the new .js and you can use the forward/back feature. When I get time, I will update posts 1-3 with the new available info. Thanks for the heads up bud! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|