Hi All,

This is a simple example to create Ajax enabled Quick tab, But to use this you need prior knowledge of Drupal.

1) To use quick tab feature you need to install quick tab module from: http://drupal.org/project/quicktabs

2) Create menu and  define function to show tab contents.

<?php

//Function calling.

echo show_quick_tabs();

//Function definition start here

function show_quick_tabs(){

$array_tab =  array(// This will  be your array having number of tabs you want to show);
foreach($array_tabs as $tabs_id){
$res_id    = $tabs_id[‘record_id’]; // You need to define it in above array “$array_tab”

$title = $tabs_id[‘record_title’];  // You need to define it in above array “$array_tab”
$mytabs[] = array(
‘title’   => $title,
‘weight’  => 0,
‘teaser’ => FALSE,
‘hide_title’ => TRUE,
‘path’ => ‘show_quick_tabs/’.$res_id,    // This is a menu path to be called.
‘type’ => ‘callback’,
);
}
$quicktabs_options = array(
‘style’   => ‘Navlist’,
‘ajax’    => TRUE,
‘hide_empty_tabs’ => TRUE,
);
$quicktabs_name = ‘dynamic_quicktabs_menu’;

// This is quick tab handler, It will create your quick tab.
$quicktabs = quicktabs_build_quicktabs($quicktabs_name, $quicktabs_options, $mytabs);

return drupal_render($quicktabs);
}

?>

Advertisements