hey oh:
I have read alot of people with the issue of passing arguments to the view through quick tabs.
It seamed everyone was looking to use a non-dynamic argument and it was good. I am looking to pass a dynamic argument.
I read in http://drupal.org/node/323451 version 6.x-2.x-dev there is a solution to this.
attached screenshots
as I am using 6.x-3.0 I am confused
the edit quick tab page under view argument. says
"Additional arguments to send to the view as if they were part of the URL in the form of arg1/arg2/arg3. You may use %0, %1, ..., %N to grab arguments from the URL."
the solution to the 6.x-2.x-dev says
"The arguments in Quick Tabs itself are for passing non-dynamic arguments, where you actually specify the argument, e.g. you would pass in 'business' or 'politics', but that would mean it wasn't getting it from the url"
so I am confused. it appears that the newer version includes this functionality?? but i am unable to to get this argument to validate with the quick tabs. i have tried a retarded amount of combinations on the view and the quick tab trying to get something to work.
I am using the node title as the argument, and the argument validates in the view.
I have tried the solution from the earlier version also
starting to think i just have no idea how to type in the argument in the quick tab view argument field?
I have a node at community/regions/%node
how could one pass %node to the view from the quick tab
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| arguments in quicktabs - drupal.org 2011-08-03 18-38-39.png | 14.54 KB | stonewalker | |
| Edit - ClimbersConnect.com 2011-08-03 18-40-52.png | 15.78 KB | stonewalker |
Comments
Comment #1
montchr commentedI'm confused here as well... same issue.
edit: I should add that I'm running 7.x-3.0.
subscribing
Comment #2
kgeographer commentedsubscribing
Comment #3
austintnacious commented@ stonewalker
You're not going crazy dynamic arguments DO NOT WORK with quicktabs. . . yet!?
I've been trying with as many different configurations as I can think of and trying to use dynamic arguments simply DOES NOT WORK.
My views work, if I use the equivalent static argument in quicktabs the views work, try with dynamic arguments as describ e in the Quicktabs interface and the views break.
If the interface says the module does something but the module in fact does not do that thing the issue becomes a bug and it's really a pretty critical bug because the module really should be able to handle dynamic arguments.
I wish I could fix it myself but I can't!
Comment #4
katbailey commentedQuicktabs does support %-style arguments in Views. For example if your path is my/path/[nid] where [nid] will be an actual node id, and if your quicktabs instance includes a view that takes a node id as an argument, you would pass this to the view by adding '%2' in the arguments field when configuring that tab.
Comment #5
austintnacious commentedI am sorry but dynamic arguments do not work!!!
Again, I've tried every ridiculous interpretation of "you would pass this to the view by adding '%2' in the arguments field when configuring that tab" and it does NOT work.
My views work.
If I pass the equivalent static argument to the view using the quicktabs settings then the view works.
As soon as I try to use the dynamic argument place holder the view breaks and the quicktab displays the text for when the argument does not validate.
I wish it did work (rather than having to create dozens of quicktabs using static arguments I could have created one quicktab to handle all possible arguments) but it doesn't.
If it works for you but not for me where my views and quicktabs both seem to work absolutely perfectly except for the dynamic args in quicktabs doesn't that look like some kind of bug or conflict to you?
Comment #6
alexlangberg commentedI have the same problem, Quicktabs version 7.x-3.2.
I have set up a taxonomy with pathauto to create stuff like "domain.com/dictionary/word".
I then put a quicktabs block on the taxonomy page for each word, with the word passed as a dynamic argument. So, for instance if we have "nature.com/animals/fish", I pass the "fish" argument on to the quicktabs. However, it doesn't show any results. If I just type in "fish" in the arguments field, the correct results show.
It's interesting that if I use "%0" or "%1" etc., I get no results. However, as soon as I run out of available arguments in the URL, I get all words, since the view suddenly gets nothing passed and defaults to "all", as I have set it to. This seems to indicate that by using "%0" and "%1" etc, the view gets something passed, just not a value it can use.
Comment #7
austintnacious commented. . . I'll second that!
In my case both %0 and %1 give the text I've set up in views to display when the argument does not validate.
I want %2 to affect my view but when I try %2 I get "all" instead as described by alexlangberg.
In my case when a user goes to //archive/category/participation (which is my taxonomy path for the term "participation") they should see a list of nodes tagged with child terms of the parent term "participation".
The view and its displays work. When I use the static arg "participation" I get what would be the results for "all" while %1 and %2 give results for arg does not validate.
Comment #8
alexlangberg commentedIs somebody able to provide a working example then? Where dynamic arguments are used? I'd love to get this functionality to work, it is very, very useful.
This has been a bug for a long time and a pretty big one in my opinion, considering that this could be a bug that is quick to fix, since it must have worked at some point. If somebody can point me to the php file for this I can take a look, but I don't know if my php skills suffice.
Comment #9
gregsomers commentedI am having this same issue.. Has this not been fixed yet?
UPDATE: After looking at the code, the module calls args(), in my case, the values returned from that are different than the URL. For example, my URL is "product/reading" however, quicktabs gets this Array ( [0] => node [1] => 180 ). So I have to change my view to use the node ID instead of the node title. This should have been noted in the modules documentation.
Comment #10
calefilm commentedMaybe this will help. In my case I set up quicktabs on a user profile page at user/username
In quicktabs I select the view I want to incorporate with an argument of %1.
The view i've selected is a view that adds fields for a user who has listed his 3 acheivements. So it's a basic view that I just wanted to appear on the chosen user's page.
Contextual Filter: UID
a. Display all results for the specified field
b. Specify validation criteria
-Validator = "Basic Validation"
when i go to user/mark, the view displays as expected.
Comment #11
Alexnick commentedI have the same problem, but on nested quicktabs (Core 7.14, Quicktabs 7.x-3.4). To re-create the problem, try the following steps.
1. Create a view with a contextual filter needing an argument that can be grabbed from the url.
2. Create a quicktab (A) with the above view.
3. Create another quicktab (B) containing the same view and quicktab (A).
Now, test quicktab (B). The view which is contained directly inside quicktab (B) will work fine. However, the same view will not work in the nested quicktab. I poked around the code and with the help of a few prints I found out that the module doesn't apprear to be sending url arguments to the view inside the nested quicktab. I also believe that the module won't send the real page uri (/node/nid) in the nested quicktab, but a uri based on the parent quicktab. Therefore, if you set your contextual filter to get the argument from the url by itself with php code, it will work fine in quicktab (B), but it won't in quicktab (A).
Btw, this is clearly either a code issue or some bug/incompatibility with views/other modules, so I am changing the thread component from "User interface" to "Code".
Comment #12
filodusa commentedThis is not a bug nor incompatibility with views. What the labels
%0,%1,%2mean is not the argument as given in the view, but the position of the argument in URL. So if you have an URL for examplecommunity/regions/%node(see the original post), the correct "argument" corresponding to%nodein quicktab setting will be%2(because it is in the third position in URL arguments - first position=%0=communities, second position=%1=regions).Comment #13
TBarina commentedUsing the system as stated in #12 I can have both plain and nested quicktabs with arguments being pass correctly to all the views involved.
The only problem is that passing arguments to nested qtabs only works with non ajax configurations of QTabs. Of course using multiple nested qtabs without ajax would generate performance hits.
Is there a way to use ajax when setting up multiple nested qtabs?
Thanks in advace for any help.
Comment #14
vjorden commentedTHANK YOU! This one single post helped me figure out why I couldn't get Quick Tabs to work the way I wanted!
THANK YOU!!!
Comment #15
ñull commentedI felt free to add the conclusion of this thread to the documentation. Please revise the documentation if you feel it is still unclear. Please comment here if you find it helpful. With sufficient positive comments, we can mark it as fixed.
Comment #16
mb7419 commentedReplace $url_args = arg() with $url_args = explode('/', request_path()) ( in file QuickViewContent.inc) to fix this issue.
The issue seems to be that the code gets the system path and so will not work in case of alias.
With above you can just pass %0 for first argument , %1 for second and so on
Comment #17
netw3rker commented@mb7419
I wouldn't recommend that. the system path is the path that is needed, and should be the value that all drupal code relies on. if the url "node/1234" has an alias of "content/myexample", the value of %1 should be 1234, and not "myexample".
Comment #18
netw3rker commentedThis is now documented at #2405537: Using dynamic arguments in quicktabs. Thanks for the discussion, and please update the noted page to make it more complete!
Comment #19
qqboy commented@TBarina thanks very much, it s a problem as you said, since a ajax load view block can not make use of argument passed from url, then only all load at the first time page loading, if you solved this problem, please let us know. thank you very much.
Comment #20
qqboy commented#4 great
Comment #21
torreytoomajanian commentedMy problem occurred while trying to nest a set of Quicktabs that have a View pane within a parent set of Quicktabs that loaded panes via AJAX. This set of Quicktabs was embedded on my user profile page at path: "user/%" where % = UID or username. The nested View pane was using a View page located at path: "user/%/bio/about". It was set from within its Quicktabs instance configuration page to use path argument %1, in this case, %1 to pull in the UID argument. This worked perfectly when placed as a normal QT block, but when nesting it inside of another QT block, every time the AJAX loading was triggered the View would return whatever it was set to display when the View argument was incorrect or returned nothing, rather than the proper results of the View.
Despite this discussion and a couple others that I've seen on this issue, I could not find an answer to the problem that actually explained it. In backtracking through the Quicktabs module, I was able to locate the problem area within the render() function in QuickViewContent.inc, more specifically lines 117-142:
This snippet parses out the argument data from the classes' __construct method and builds the View object from scratch. The path that it is receiving contains the View information needed to load it, set the View Display that you chose to render in the Quicktab's View pane, pass in the proper contextual argument(s), and render it as HTML for the pane to display. Debugging the $item['actual_args'] value revealed that the argument being passed to my View using %1 was "ajax", rather than the UID 1 from the profile I was viewing. This meant that the path that was being parsed to get the argument was incorrect.
Because I was using %1, any normal Quicktabs View pane that was not nested would have pulled in the %1 argument as "1" from the "user/1" page I was on, and plugged it into "user/%1/bio/about", returning the correct View data. But when nested within another set of Quicktabs, the URL being used was actually "user/ajax/bio/about".
I discovered that within the same __construct method in of QuickViewContent.inc, line 63 sets the View path using $_GET['q']:
But because this is being requested via AJAX, the URL being used is actually: "quicktabs/ajax/user_member_profile_quicktabs/1/qtabs/user_member_profile_bio"
In knowing this, you can see that the %1 argument is in fact "ajax", which explains why that was being passed into the View. You can also see that the "1" value we should be passing in actually located at argument %3. Because any nested QT situation like this that is using a URL argument has to use the same URL as its parent QT does, all you have to do is set the URL arg token in your nested Quicktab's settings to %3. This may vary if the View is using multiple contextual filters in different path positions than %1, but the same logic applies. This could be patched to use a better way of building the URL after an AJAX request than the current $_GET['q'] method, but because it is technically using the correct URL (just not the one that most people are expecting), you could argue that it isn't actually a bug.