Thread: Forum Home Enhancements - [AJAX] Tabbed Forum Home
View Single Post
  #45  
Old 04-11-2008, 12:38 PM
bobster65's Avatar
bobster65 bobster65 is offline
 
Join Date: Mar 2006
Location: Montana
Posts: 1,169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CHIPIT View Post
Thanks! Great mod, installed and nominated.
One thing though...

For dynamically selecting a tab we're supposed to use
<a href="javascript:instance.expandit(1)">Select 2nd Tab</a>

What is exactly is the instance? How is it defined? and when you say tab# starting with 0, would the first one (0) be the one with the first tabbed link, the first one in the code itself, or tcontent1??
Thank you

To answer your first question, the instance is the var name in this chunk of script that you added in Step 16: (Bold Red)

Code:
<!-- Tabbed Forums switch tab script -->
<script type="text/javascript">
var myforumtabs=new ddtabcontent("forumtabs")
myforumtabs.setpersist(true)
myforumtabs.setselectedClassTarget("link") 
myforumtabs.init()
</script>
<!-- /end Tabbed Forums switch tab script -->

So to further expand on this function: instance.expandit(tabid_or_position)

This method lets you dynamically select any tab based on either its ID attribute (you need to first assign one to that tab), or position relative to its peer tab links. The method can be called anywhere on the page, such as inside a link on the page.

Parameter:

tabid or position: Either a string representing the tab link's ID, or an integer corresponding to that tab's position relative to its peers, to select. For the later, the counting starts at 0 (ie: 0=Tab 1, 1=Tab 2, 2=Tab 3 and so on).

So to answer your question, 0=the first tab. tcontent1=the content of the tab itself, not the ID of the tab.

Example:

Based on the following sample tabs layout, I added a tab ID to Tab 2. You don't need to do this as you can also just call the position as well.

Code:
<ul id="forumtabs" class="shadetabs">
<li><a href="#" rel="tcontent1" class="selected">Tab 1</a></li>
<li><a href="#" rel="tcontent2" id="roses">Tab 2</a></li>
<li><a href="#" rel="tcontent3">Tab 3</a></li>
<li><a href="#" rel="tcontent4">Tab 4</a></li>
</ul>

Here are some examples of how the links can be used:

This one uses the position parameter:
Code:
<!--Selects 4TH tab within instance "myforumtabs" -->
<a href="javascript:myforumtabs.expandit(3)">Tab 4</a>

this one uses the tabid parameter
:
Code:
<!--Selects tab with ID="roses" within instance "myforumtabs" -->
<a href="javascript:myforumtabs.expandit('roses')">Select "Roses" tab</a>

Hope that helped out and answered your questions..

Bobster
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01134 seconds
  • Memory Usage 1,783KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete