I am using Drupal 7 & quicktab . I am trying to create quicktabs from codes. Suppose i created the a test url in using hook menu.
$items['MyModule/test'] = array(
'title' => 'Test Tabs',
'type' => MENU_CALLBACK,
'page callback' => 'test',
'page arguments' => array(2),
'access arguments' => array('access content')
);
In test function ,
function test(){
$name = "Test tabs";
$settings = array(
'ajax' => 0 ,
'hide_if_empty' => 1,
'default_tab' => 0,
'title' => 'Test quicktabs',
'rendered' => 'quicktabs',
'style' => 'Basic',
);
$custom_tabs = array(
array(
'title' => 'Test tab1',
'path' => 'test-tab1',
'contents' => "Test tab1",
'weight' => 0
),
array(
'title' => 'Test tab2',
'path' => 'test-tab2',
'contents' => "Test tab2",
'weight' => 0
));
return drupal_render(quicktabs_build_quicktabs($name, $settings, $custom_tabs));
}
By using above code , i am successfully able to create quicktabs, But It is showing same (Test tab 1) content on both tabs. Content is not changing. I cleared the cache also. Also, How to edit the path of tabs?? Above path is not working . It is showing ugly path like this (http:[baseUrl]/test?qt-my_custom_quicktab=3&qt-Test%20tabs=0#qt-Test%20tabs)
Is there any better way to implement quicktabs.May be with hooks but documentation is insufficient. If anyone knows better implementation guide me . My tabs will be dynamic.
If your problem is just the ugly query string ?qt-my_custom_quicktab=...
, you can prevent that using javascript by disabling the default click action for the links that toggle tab-panels.
Example:
jQuery(function() {
jQuery('#your-quicktab-link-selector').click(function(evn) {
evn.preventDefault();
});
});
This is a very old question, but I figured I'd answer for anyone else who stumbled upon the same issue (as I did).
The problem is that your variable $name (or the first parameter to quicktabs_build_quicktabs()) should not have spaces. So, if you do something like the following, it will work.
$name = "Test-tabs";
The issue is that quicktabs assigns that string as part of the ID of the div wrapper on the tab. If it has a space in it, then the javascript code won't successfully hide or show the correct tabs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.