I am using the Quicktabs module, and want to change the default tab that loads based on their selection from a menu which carries them to a page with a Quicktabs block on it. Is it possible to do this using Quicktabs and how exactly can I achieve this.

Comments

jpdaut’s picture

stewie32 did you find out how to do this? I'm trying to do the same. I'm running Drupal 5. THanks

stewie32’s picture

Unfortunately jpdaut I never found out how to do this. I had to try another approach. Did you however find a solution I would still like to know how to achieve this

apaatsio’s picture

Here's instructions how you can render quicktabs with custom default tab. Depending on what you mean by menu and how you carry them to the new page, you have to figure out yourself how you pass the tab id.

The _quicktabs_get_active_tab function examines the URL parameters, i.e. the $_GET array. Here's a quick fix to render the tabs with the second tab selected

$qtid = 1; 
$active_tab_id = 1; // the second tab; index starts from 0 
$_GET['quicktabs_'. $qtid] = $active_tab_id; // set active tab
$qtabs = quicktabs_load($qtid);
$output = theme('quicktabs', $qtabs);

Another way is to modify the quicktabs_render function's way of determining the active tab in quicktabs.module. Remove the line

$active_tab = _quicktabs_get_active_tab($quicktabs);

and add a function argument $active_tab

function quicktabs_render($quicktabs, $active_tab = 'none')

Then you can render it with

$qtid = 1; 
$active_tab_id = 1; // the second tab; index starts from 0 
$qtabs = quicktabs_load($qtid);
$output = quicktabs_render($qtabs, $active_tab_id);

I didn't test the latter method.

I used Quicktabs version 2.0-rc3.

ansari.wajid’s picture

Hi apaatsio

I have a quicktab with 2 tabs in it. Each tab contains user defined menu block in it. Lets say tab1 contains menublock1 and tab2 contains menublock2 under it. tab1 is the default tab. This quicktab is shown on all the pages.
The problem is when I select tab2 and clicks on menuitem under it, After page load it shows tab1 as selected. I need tab2 to be selected as I selected menuitem under tab2.
Is this possible, Please let me know how to achieve it. I am using quicktabs 6.x-2.0-rc4

Thanks

msbrar’s picture

New version of quick tab supports parameter qt-"name of the quick tab instance"=tab number as a parameter in Get request for active tab