Hello,

Is it possible to create URLs for each tab with only a fragment (#)?

Example:
www.mysite.com/node/89 -> tab 1
www.mysite.com/node/89#name_of_tab2 -> tab 2
www.mysite.com/node/89#name_of_tab3 -> tab 3

My current code in my node:

<?php
$tabs['presentation'] = array(
  'title' => t('Presentation'),
  'type' => 'block',
  'bid' => 'modele_2r_delta_modele_2r_presentation_block',
  'hide_title' => TRUE,
);
$tabs['fiche_technique'] = array(
  'title' => t('Fiche technique'),
  'type' => 'block',
  'bid' => 'modele_2r_delta_modele_2r_fiche_technique_block',
  'hide_title' => TRUE,
);
$tabs['commentaires'] = array(
	'title' => t('Commentaire'),
	'type' => 'view',
	'vid' => 'comments',
	'display' => 'block_2',
	'args' => '%1',
);

$quicktabs['qtid'] = 'modele-2r-id';
$quicktabs['tabs'] = $tabs;
$quicktabs['style'] = 'Excel';
$quicktabs['ajax'] = FALSE;
print theme('quicktabs', $quicktabs);
?>

Thank you for your help.

Comments

pasqualle’s picture

Category: task » feature

Currently it is not possible. I always wanted to add this setting to QT, but did not have the time to implement it.
The quicktab will not work when javascript is disabled in the browser, but many users would prefer it anyway.

If someone would like to jump on this feature:
- in theme_quicktabs_tabs() the

$output .= '<li'. $attributes_li .'>'. l($tab['title'], $_GET['q'], $options) .'</li>'; 

part needs to be changed.

Clément’s picture

Thank you very much,

I found this function I changed.

Before:

  $link_options = array(
    'attributes' => array(
      'id' => $id,
      'class' => $class,
    ),
    'query' => $query,
    'fragment' => 'quicktabs-'. $qtid,
  ); 

After:

  $link_options = array(
    'attributes' => array(
      'id' => $id,
      'class' => $class,
    ),
    'query' => NULL,//$query,
    'fragment' => $query['quicktabs_'. $qtid],//'quicktabs-'. $qtid,
  ); 

Now the url works.

It remains just one last (big) problem: When I click on a tab, the tab opens without changing the URL of the page. How to enable tabs with the url? Thank you.

pasqualle’s picture

the tab opens without changing the URL of the page

yes, that is the main functionality of the module. You can see more content without leaving the page (without page reload).

netw3rker’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)