Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello All
I am new to drupal. I have created a quicktab & now I want to access a specific tab directly through the URL is it possible ??
regards
Comment | File | Size | Author |
---|---|---|---|
#43 | quicktabs-direct-url-to-a-tab-308633-42.patch | 1.15 KB | badrange |
Comments
Comment #1
badawy CreditAttribution: badawy commentedwhat I mean is that when I open the page a tab other than the first one is opened
any help is appreciated,
Comment #2
aaustin CreditAttribution: aaustin commentedI love this module and really want to implement it in my site but have come across this same barrier. In certain circumstances, I want to link to a page and have the second or third tab be active instead of the first.
I think it is pretty useful to pass the active tab as an argument in the URL, something like this: /node/23?qt_active=2 or if you were worried about your links being broken when you reorder tabs, perhaps /node/23?qt_active=user_delta_1
I have been hacking away at it this morning and think I have it working fairly well (handling both types of arguments) by doing the following, sorry my approach show my bias for doing things in php rather than js:
In the quicktabs.js file I removed the js code that found the first tab and made it active:
In the quicktabs.module starting at line 620, I added:
Is there any chance of getting this in to the module? Or something similar, I think it could be very useful for a lot of people.
Comment #3
aaustin CreditAttribution: aaustin commentedSorry, accidentally changed issue title. Changing it back.
Comment #4
aaustin CreditAttribution: aaustin commentedWhoops. The code above only fixes the tabs, not the content.
Fortunately, the same thing works for the content.
Remove the js for making the first
Becomes:
As a side note, I realize, there must be a way to give the default tab and content div an additional class and have the js find that class (as opposed to first-child), and make that active, which would probably be a better use of jquery. However my js / DOM / CSS skills are not so good.
Then around line 635 (my line numbers changed with the code from 2 comments up):
Comment #5
katbailey CreditAttribution: katbailey commentedGreat! thanks for this - this was totally the next feature on my to-do list for Quick Tabs. I will review your code and hopefully get something committed by early next week.
Katherine
Comment #6
katbailey CreditAttribution: katbailey commentedOK, there's a bit more to this than meets the eye. In order for this feature to be really useful, the url needs to change as you click on the different tabs. After doing some research into this, I have found that this is a non-trivial task and is best done with the jQuery History/Remote plugin. I don't want to include this plugin with the module because there are other modules including it and this is not really the way to go. There is a module called jQuery History (http://drupal.org/project/jquery_history) which provides a similar, seemlingly deprecated plugin, which could be of use if it updates itself to the History/Remote plugin instead. While I don't want a dependency on this module, I could do a check to see if it's there so that this particular feature is dependent on it. It's still a lot of work getting the tabs to work with this plugin though.
Thoughts?
Comment #7
kwgossett CreditAttribution: kwgossett commentedHey Katherine,
Have you or any others found another way around the issue above? If you've got any ideas, suggestions, patches, etc, I'd be glad to help troubleshoot.
Thanks,
Kelly
Comment #8
PasqualleComment #9
Pasquallehttp://drupal.org/cvs?commit=158161
fixed, and as a little bonus QT works nicely without javascript now
(the javascript is checked from a Drupal cookie, so clear the cookies if you would like to test that)
and the direct link is:
this will open the third tab of quicktabs 42 which is on mypage page, and position (scrolls down) to the quicktabs wrapper
you can even open multiple quicktabs this way:
Comment #10
Pasquallehere is a working example (this will open the third tab of quicktabs-1 on the user/password page)
http://64.55.119.4/user/password?quicktabs_1=2
It is not possible to change the tab on the inner quicktabs-2 like
http://64.55.119.4/user/password?quicktabs_1=2&quicktabs_2=1
because it is an ajax loaded quicktabs and it is not yet rendered when it is targeted by the direct link. If the upper quicktabs would be a non ajax quicktabs only then it would be possible to change the tab by direct link..
Comment #11
Pasqualleand also when you are on the test site, try it with disabled javascript. It works nicely, just remember that you have to clear the cookies, after you disable the javascript..
Comment #13
malancheril CreditAttribution: malancheril commentedHi,
I am not able to get this work. The URL I am using looks like this:
http://www.mysite.com/?=content/pagename?quicktabs_1=2
Sorry I am a newbie to Drupal and PHP so not sure if I'm doing something dumb. I am under the gun on a deadline so any help soon would be greatly appreciated.
Comment #14
Pasquallemissing q
http://www.mysite.com/?q=content/pagename?quicktabs_1=2
if you do not have clean-url enabled then the correct format is
http://www.example.com/?q=page
Comment #15
malancheril CreditAttribution: malancheril commentedThanks for the quick reply. My mistake, I forgot to type the q in the posting. When I enter:
http://www.mysite.com/?q=content/pagename?quicktabs_1=2
...I still get "page not found".
Comment #16
Pasquallethen
http://www.mysite.com/?q=content/pagename
must result also in "page not found"..the
http://www.mysite.com/?q=content/pagename
part of the url must be a valid pageComment #17
malancheril CreditAttribution: malancheril commentedIt's a valid page. Actually what I do is, I navigate to that page, then I paste "?quicktabs_1=2" to the end and I get the same error. Will it make a difference if it's:
http://subdomain.mysite.com/?q=content/pagename?quicktabs_1=2
I'm guessing that adding the subdomain doesn't matter. Also, to clarify, when I go the main page and hover over an inactive tab, in the browser's status bar, I see that the link is:
http://subdomain.mysite.com/?quicktabs_1=2
...which works when I click it from this page, but obviously doesn't when I just cut and paste the URL directly into a browser. I'm not sure why the full URL isn't shown.
Would it help to turn AJAX off? I noticed the arguments look different if I do (#quicktabs-1=2 instead of ?quicktabs_1=2).
Comment #18
Pasquallethe tab link does not need the full url as it will not make a new page load..
try to turn off javascript in the browser (and clear the cookies), then the tab links should show the full url (which you could use as direct link to that tab)
Comment #19
malancheril CreditAttribution: malancheril commentedPasqualle, thanks for all your help BTW.
So I turned off javascript and cleared cookies (twice for good measure). The link (when I hover over the third tab) still says:
http://subdomain.mysite.com/?quicktabs_1=2
...when I hover over it. But now when I click on a tab it takes me to my home page instead of switching the tab. I can verify that javascript is off b/c the flash on my home page doesn't work and cookies have been cleared b/c I had to log back in to post this response. Thanks.
Comment #20
PasqualleI can confirm that there are problems with disabled clean-urls. created a new issue for it: #362831: problems with disabled clean-urls
please comment on that issue if you would like to add something..
if you can enable clean-urls (?q=admin/settings/clean-urls) that would solve your problem for now, otherwise you will have to wait for a fix.
Comment #22
dlumberg CreditAttribution: dlumberg commentedhttp://subdomain.mysite.com/?q=content/pagename?quicktabs_1=2
should be
http://subdomain.mysite.com/?q=content/pagename&quicktabs_1=2
notice the &, the "quicktabs_1=" is an argument in addition to the "q="
for clean urls it should be
http://subdomain.mysite.com/content/pagename&quicktabs_1=2
Comment #23
Pasqualleyes, the direct links with disabled clean-url is:
with enabled clen-url, both options work
you may construct the link with the l() function. (I did not tested, so there might be a typo in this code)
this should automatically create the right url. Based on you clean-url setting the link will be
moving the issue to documentation.
Comment #24
southweb CreditAttribution: southweb commentedHi
I'm new to quicktabs, and I thought I was reasonably confident in javascript, but am struggling with what must be obvious.
What I don't get is how to map a tab option to an internal 'path' - not a qtab, node or block. i.e. I just want to specify a path that will get loaded when the tab is clicked on. Is this so hard?
I debugged the code and found that an ajax method is being invoked, and a JSON string returned, but how do I map the qtab name to a URL. Is there something about taxonomy?
Sorry, this is must be so simple, but would appreciate your support. Also, the only docs I found were in the README which says nothing about this. Am I missing the docs somewhere else?
thanks.
Comment #25
Pasqualleyou can't, there is no such option..
#380852: Cannot assign a QT to a path
#462092: Arbitrary Menu Callback as tab content
Comment #26
tchopshop CreditAttribution: tchopshop commentedI want to create a menu link directly to a tab -- and I have that working -- but is there any way to stop it from jumping position to the tab wrapper and just show the page with that tab open?
Comment #27
dlumberg CreditAttribution: dlumberg commentedUnfortunately it's a browser thing to go to the hash from the URL, you might be able to do something with jquery and a focus() when the page loads.
Comment #28
tchopshop CreditAttribution: tchopshop commentedI *love* quicktabs... but I really need to be able to link directly to a tab page from a menu system... not the tab wrapper... I don't know jquery but I imagine that solution would be even more jumpy.
Please, anybody... it looked like there was a solution here http://drupal.org/node/266313 with comment #6 & 7... and I got that to work, briefly... but it stopped working.
Comment #29
Pasquallecan you tell some details why do you need that? If we know what would you like to achieve, then maybe we could find a solution or an advice.
Comment #30
tchopshop CreditAttribution: tchopshop commentedI have quicktabs functioning as (sub)pages and I have it located inside my main content area, not in a sidebar.
I used the Jquery menu to allow a visitor to open up the menu tree, then the visitor can click to go to a subpage, which is actually a quicktab page. Clearly, it would not make sense to have the visitor go to the first subpage -- they should go to the page that they clicked on.
I think I solved the problem of linking to the quicktab, with the following:
http://URL/MY-PAGE&quicktabs_1=0?quicktabs-1 (where 0 is the first quicktab, followed by 1,2,3,etc)
not http://URL/MY-PAGE&quicktabs_1=0#quicktabs-1 (which is what was recommended in some other thread)
the hash in the one above makes it jump down to the quicktab wrapper, which is not what I want. But I discovered that changing the # to a ? makes it work correctly.
HOWEVER, that solution only worked for the FIRST block of quicktabs. The next primary menu item has another block of quicktabs for its subpages and that code DID NOT work for that.
But I discovered that this did:
http://URL/MY-PAGE&quicktabs_1=0 (where 0 is the first quicktab, followed by 1,2,3, etc)
So I don't know what is up with Quicktabs code, but that is what is working now... the first block has one pattern for linking, and the second has a different one... I don't know what problems will arise when I create a 3rd. I should add that I still have the code mentioned in http://drupal.org/node/266313 with comment #6 & 7 to the bottom of the quicktabs.js file. I don't know what it's doing if anything...
But it seems to me that this is an obvious use of Quicktabs and there should be a way to make it work easily.
Comment #31
M_Z CreditAttribution: M_Z commentedI came to this thread because of some redirect problems in case of form validation errors.
I built a quick tabs block with 3 different forms and when I hit the submit button at tab 2 or tab 3, I always got redirected to tab 1 after validation errors occured.
I want to share my solution which must be included in hook_form() or hook_form_alter():
$form['#action'] = url($_GET['q'], array('query' => array('quicktabs_QUICK_TABS_ID' => QUICK_TABS_TAB_ID)));
where QUICK_TABS_ID could be '1' and QUICK_TABS_TAB_ID could be '0', '1', '2', ...
Maybe it can help others with similar problems... Now the 'strange behaviour' is away and redirection with validation errors works as expected.
@ #30: It seems that there are some difficulties with the different meaning of separators in URLs - after understanding this everything is quite easy - and hard-coding of URLs or links is bad style - better use Drupals built-in functionality url(...) or l(...) - see Drupal API for details
Quick description of the different separators in URLs:
? - separates the path ('normal' URL) from query parameters (e.g. http://www.example.com/current/path?param1=value1)
& - separates different query parameters (e.g. http://www.example.com/current/path?param1=value1¶m2=value2)
# - separates query parameters from fragment ('anchor'/id where the browser should scroll to) (e.g. http://www.example.com/path?param1=value1¶m2=value2#example-anchor)
Comment #32
tchopshop CreditAttribution: tchopshop commentedI know it's bad form, but Drupal 6 forces you to hard-code in a full direct URL in the menu structure because it doesn't recognize the quicktab as an internal page.
I don't want to have to do it that way... but I need to link directly to a tab from a separate menu structure *as well as* the quicktabs menu system.
The wierdness happens because the URL for the first set of quicktabs is quite different from the URL for the second set of quicktabs. You would think it would be the same logical structure.
Comment #33
M_Z CreditAttribution: M_Z commented@ #32: Drupal's url() function gives you an option to set 'absolute' => TRUE to get (what you called) a 'full direct URL' (see API: http://api.drupal.org/api/function/url/6)
But I think there is still some confusion about the difference between the path to an internal page (like 'node/6' or 'MY-PAGE' in comment #30) and some query parameters (which is used to navigate directly to a tab in a quick tabs block). But if your solution is working well for you, than everything is fine :-)
Maybe I misunderstood your problem which could be related to http://drupal.org/node/383880?
Comment #34
southweb CreditAttribution: southweb commentedComment #35
Pasqualleneeds documentation
Comment #36
eeenglish CreditAttribution: eeenglish commentedIs there a change to the direct url to a specific tab protocol for Drupal 7? I can't seem to get the url structures in the examples above to work (yes, removing the "content" path as that's no longer used in 7).
I'm using quicktabs-7.x-3.0-alpha2, my quicktabs instance is using renderer=quicktabs. Clean-urls are enabled.
Trying to link directly to the 2nd tab in my instance (without using JavaScript), and none of these URLs are working:
Doesn't seem to matter if I turn ajax on or off, and I've tried all of these in multiple browsers.
Comment #37
katbailey CreditAttribution: katbailey commentedStrange. What happens if you right click on one of the tabs and choose to open it in a new tab/window (assuming your browse provides this option)?
Comment #38
eeenglish CreditAttribution: eeenglish commentedDoesn't work either. Right-clicking a non-active tab and opening it in a new tab/window just results in the same view. Tried this in several browsers, cleared history/cache, etc.
Comment #39
escoles CreditAttribution: escoles commentedDoesn't seem to work with image maps.
Use case: Tab is an image; requirement is that user be able to click at a spot in the image to advance to the next tab.
Comment #40
djmy CreditAttribution: djmy commentedsame here to #38, have the latest QT and everything is working except when i want to point to a specific tab. does anyone know if the 7.3-dev works?
Comment #41
Anonymous (not verified) CreditAttribution: Anonymous commentedI had the same problem, but discovered that switching off the Drupal caching makes the links work again (right clicking on your tab and opening in a new window gives you the working links).
Any way to get these working in conjunction with Drupal's cache...?
Comment #42
Exploratus CreditAttribution: Exploratus commentedDirect link doesnt work for me. Latest v7 release.
I dont have cache enabled.
Comment #43
badrange CreditAttribution: badrange commentedIt seems that the module is not consequently using qt or quicktabs when it generates html elements. I hope the attached patch helps.
Comment #44
badrange CreditAttribution: badrange commentedComment #45
badrange CreditAttribution: badrange commentedComment #47
jazzitup CreditAttribution: jazzitup commentedI confirm that this issue is related to caching. If you clear all of the performance settings, then clear your caches, run cron - you can achieve the desired feature. But still - the problem persists for users that seek for better performance (caching).
Comment #48
badrange CreditAttribution: badrange commentedUpdating the version so that the testing bot will test against the correct branch
Comment #49
badrange CreditAttribution: badrange commented43: quicktabs-direct-url-to-a-tab-308633-42.patch queued for re-testing.
Comment #50
Exploratus CreditAttribution: Exploratus commentedAgreed #47. I need to use caching
Comment #51
badrange CreditAttribution: badrange commentedExploratus: Have you tried with the patch and caching at the same time?
Comment #52
docans CreditAttribution: docans commentedAny progress to this issue. Do i use the patch or the dev version?
Comment #53
badrange CreditAttribution: badrange commentedPlease try and review the patch. It should apply to the 3.6 version. Haven't tried it against dev for a while.
Comment #54
jazzitup CreditAttribution: jazzitup commented#51: I tried the patch (#43) AND caching at the same time (cleared server-side cache, ran cron, cleared browser's cache, SHIFT+refresh the page, tried another browser) - unfortunately the issue is still there.
Comment #55
docans CreditAttribution: docans commentedOne more thing i notices is that links to tabs withing tabs do not work. And the tabs themselves do not link. Any idea
Comment #56
Dublin Drupaller CreditAttribution: Dublin Drupaller commentedissue is still here guys. am using 7.x-3.6
Comment #57
sigkg CreditAttribution: sigkg commentedHi.
I also have quicktabs v3.6 with clean urls. This is the problem:
The URL is something like this. localhost/search-find/books/?qt-libtabs=0
I think the problem is the way the URL is structured. Is there a way to just make it /search-find/books for a tab without the /?qt-libtabs?
Thanks
Comment #58
mattiasdk CreditAttribution: mattiasdk commentedAny solution to this problem?
It seems to have been introduced in the current dev-version.
When clicking a quicktab on node 1, navigating to another page (ex. node 2) and then turning back to node 1, the (earlier) clicked tab will still be selected/active. This "can" be a feature, but how to disable that feature when not needed?
AND the real problem is that this behavior overrides the direct link to a specific tab via a query-string (ex ?qt-tabs=2) as mentioned by sigkg above. The page will load the correct tab located in the query, but when fully loaded, the quicktabs instance quickly change to the earlier clicked tab therefore overriding the query.
Any1?
Comment #59
pmaguniaThis is working for me with the current 3.x-dev version without the patch which no longer applies.
Note that the first quicktab maps to '0' so the URL below actually opens the second quicktab.
https://example.org/#MY-QUICKTABS-ID=1
Comment #60
baygon.flb CreditAttribution: baygon.flb as a volunteer commentedJust a suggestion:
In js/quicktabs.js
where you have:
Replace with:
Worked fine here.
Comment #61
james.bcn CreditAttribution: james.bcn commentedWhat is the status of this? It has been an issue with QuickTabs for years - is it possible to get this into the next release?
Comment #62
james.bcn CreditAttribution: james.bcn commentedIs this issue going to be resolved?
When will there be another release of Quicktabs?
Comment #63
PhilYHi,
The following seems to be working for me using Drupal 7.51 and QuickTabs 7.x-3.6:
• my quicktabs instance machine name is "mytabs"
• the page url where quicktabs block is on is "http://mysite.url/mypage"
then,
http://mysite.url/mypage?qt-mytabs=3
opens the 4th tabComment #64
NWOM CreditAttribution: NWOM commentedAs confirmed by #57, #59, and #63, the current dev version allows accessing the tabs via a direct URL. It is as follows:
Comment #66
Shai CreditAttribution: Shai commentedInstructions from #64 work perfectly for 7-3.8.