Select a Quicktabs default tab from the URL

By shane
Thu, 2011-08-04 10:51
7 comments

Share with Others

If you have used the Quicktabs module, you know it is an easy way to displayed tabbed content on a Drupal site. However, I ran into the situation where I wanted to load a different default tab on a page. Quicktabs allows you to select the default tab to load, however in some circumstances it may be necessary to load a different tab by default (if a user is coming from another place on the site).

As a quick example of how this might be useful, assume you have an e-commerce site that uses Quicktabs to display product information in one tab, and customer reviews in another tab. There are times when it might be useful to take a user directly from a link to the customer reviews tab instead of loading the default product information tab.

It turns out that this is actually really simple to do. I felt like I should post this information because I spent much longer then necessary looking for how to get an alternative default Quicktabs tab to load, and it was right in front of my face the entire time.

If you want to find the link to load a different tab, just hover over the tab and instead of just clicking on the tab, copy the link of that tab. You will notice that the link has an argument appended on the end that looks something like:

?quicktabs_3=1#quicktabs-3

Note: The # sign and anything after that in the argument above is not actually required.

This tells Quicktabs to load the second tab (Quicktabs starts counting at 0) in the third Quicktab block that you have created (a Quicktabs ID of 3). All you need to do is place this URL argument on the end of any link that you want to load the alternative tab as the default and your done. This is so incredibly simple, but if you are like me, it may be something you overlook.

Comments

It really was simple. Thank you!

Hi Shane,

Just want to start by saying that I'm new to Drupal and struggling to get a site built but getting better at it :o)
Amazed by what Drupal can do :)

Of all the sites I've browsed about Drupal you're is definatly the best, simple to understand and straight to the point information :o)

Keep up the good work ;o)

I read recently that quicktabs is not seo friendly which is why I stopped using it even though it's a brilliant module :o/
Is there any way to do sopmething like this with maybe views?

Thanks
Shane (the other one ;o) )

What were you reading about the SEO problems with Quicktabs? My guess is that it might be related to duplicate content. If this is the case, you may want to read up on http://drupal.org/node/1648432 which contains some workarounds to the issue.

I do not know of any contributed modules that work with views to provide tabs with Drupal 7. If you are so inclined you could build a custom module and add some custom Javascript to create your own tabs (which could load views or any other type of content), however you would be rewriting a lot of what Quicktabs already does.

It may be best to try to use Quicktabs and try to workaround and address any potential SEO issues, rather than trying to rewrite a tabs module from scratch (which would probably require a lot more work). Let me know what you decide to do or if you have any other questions.

Hi Shane,

It will be a great idea.. I got my expected result.

Thanks.

Hello,
Drupal 7
I am using Quicktab Navlist in views.
I want to show Next and previous button at the bottom.
e.g. current page ?quicktabs_3=1#quicktabs-3, click on next button then show to ?quicktabs_3=2#quicktabs-3 page.

Post new comment