Argument values passed as "ajax" inside quicktab?
| Project: | Quick Tabs |
| Version: | 6.x-2.0-rc3 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
first of all, fantastic work on this module... it has really helped save real-estate on my site! :)
my question: why am i seeing "views/ajax" when manually displaying $_GET['q'] on one my tabs?
my problem: im attempting to pull in values from the URL inside one of the tabs, but when trying to break out the arg values, im getting the content mentioned above.
$aliaspath = drupal_get_path_alias(arg(0).'/'.arg(1));
$aliaspath = explode('/', $aliaspath );when im on a page like mysite/users/steve, i would normally be able to call the code above, and get values of:
$aliaspath[0] => user
$aliaspath[1] => 5
but instead im getting the views/ajax values... i looked at this recent issue http://drupal.org/node/358137 but wasnt sure if applying some of the suggested patches would address my situation...
any thoughts?

#1
i suppose i should provide some more detail, and clarifiy one thing... im using the "load only the first tab on page view" option...
if i supply an argument of %1, my tabbed content displays just fine... the problem comes when i try to manually insert a footer link...
in one case, i have a "my friends" tab... the view displays the users friends correctly, but in the footer, i have a "view all" link that would programatically build:
users/'. $aliaspath[1]; ?>/friendsso, the link for me would be users/steve/friends, with "steve" coming from the URL... however, i get a link of users/ajax/friends...
simplified question: how can i pull the URL values into an AJAX loaded tab?
#2
another followup comment... i've tried applying the suggesions found here: http://drupal.org/node/332895
and can display the tabs, with the footer content like ive described (users/steve/friends, etc.), however... clicking on the tabs causes full page load... it looks like im getting some sort of ajax error:
Drupal.settings.quicktabs[...].tabs is null or not an object#3
one last comment... :)
if i change swap this one line in quicktabs.js:
var newDiv = tab.tabObj.type == 'view' ? '<div id="' + tab.tabpage_id + '" class="quicktabs_tabpage"><div></div></div>' : '<div id="' + tab.tabpage_id + '" class="quicktabs_tabpage">' + result['data'] + '</div>';
-for this-
var newDiv = tab.tabType == 'view' ? '<div id="' + tab.tabpage_id + '" class="quicktabs_tabpage"><div></div></div>' : '<div id="' + tab.tabpage_id + '" class="quicktabs_tabpage">' + result['data'] + '</div>';
i get the tabbed content to load with the args i want, but again, i get a full page load on each tab click... :(
#4
so you have an ajax view where in the footer you try to use this code
<?php$aliaspath = drupal_get_path_alias(arg(0).'/'.arg(1));
$aliaspath = explode('/', $aliaspath );
?>
yes, that code will return {'views', 'ajax'} array. It has nothing to do with quicktabs, as ajax views are created on the views/ajax path..
If you do not have filter, sort or pagination in the view then set the view to non ajax, set the quicktab to non ajax, and your code should work as you expected.
the view footer will not know the url if the view is loaded through ajax..
#5
-
#6
Understood, and thanks for the response... however, i have one related question...
if the AJAX quicktab is able to build the embedded view correctly, it is passed the appropriate paramaters (%1)... is there any way i can get at that value in my .tpl.php pages?
so, in my "friends" example, the quicktab is passed a value of %1... presumably the value of "steve" from the URL users/steve?
can i somehow get the %1 value to use elsewhere?
#7
**SOLVED**
for my specific scenario, i solved this problem by tweaking the ajax_path param in quicktabs.module:
function _quicktabs_prepare_views($tabs) {<snip>
if ($tab['type'] == 'view') {
// We need to pass view details to js in case there is ajax paging.
$aliaspath = drupal_get_path_alias(arg(0).'/'.arg(1));
$aliaspath = explode('/', $aliaspath );
$settings = array(
'views' => array(
'ajax_path' => url('views/ajax/'.$aliaspath[1]),
<snip>
now i can simply grab arg(2) from within the view... arg(0) = views, arg(1) = ajax, arg(2) = dynamic value
#8
hmm, that does not seem good to me. with that modification an ajax quicktab should not be able to display a view. strange..
#9
well, it works in my situation, but if this introduces a security risk, or is in some other way too kludgey, please let me know... :)