I'm doing something very simple in the ajax header:
print arg(1);
This should get me the nid of the node that the qt block is placed on, right? In the QT config I've put %1 as an argument.
For non-ajax tabs I get the nid correctly. For ajax tabs however, I get 'ajax'. What can I do? Thanks.
Comments
Comment #1
pasqualleajax tabs are loaded on the path quicktabs/ajax/node, quicktabs/ajax/block, quicktabs/ajax/qtabs or views/ajax
that is why you get 'ajax' for arg(1). The ajax loaded content does not know what is the original url..
Comment #2
Flying Drupalist commentedIs there any way to pass the original url to the ajax tab?
I thought that was what the arguments field in the qt settings were for...
In the other issue you said that "%1 argument format now works in QT." How do I print the original nid?
Thank you.
Comment #3
pasquallethe original url values are passed to ajax tab with %0, %1, ...
you can't use arg() in ajax tab.
use for example
print $node->nidin node.tpl.php and you can see the nid.Comment #4
Flying Drupalist commentedIs there something else I can use inside an ajax tab or am I totally screwed?
How do I get the value of %0 %1 and so on?
Comment #5
pasquallewhat are you trying to do exactly?
Comment #6
Flying Drupalist commentedI have a view of node referrers to a node. I'm trying to create a link in the views header to add a new node referrer.
Basically the link would look like this:
/node/add/images?field_reference=nid
This autopopulates the reference field with this node, thus creating the referrer.
Usually I can just put arg(1) for nid and be done. What else can I use?
Thanks you so much for putting up with my questions.
Comment #7
pasqualleYou can't do it in the view header. The view header is not flexible enough in views-6.x-2.x
but you can do it in view template. Just create a theme template for your view and add something like:
Comment #8
Flying Drupalist commentedDo you know if it would be possible to use the header in views 3? Doing something like this in a theme makes maintenance really hard.
Comment #9
pasqualleI do not know much about view3, but as I know it has a new handler for header and footer.
Putting php into the database (writing php in the views ui) should not be allowed..
Comment #10
Flying Drupalist commentedI wish there was a better way as well. There was some core issue discussing removing eval and such and making an interface for uploading code without storing it in the database, but it hasn't gone anywhere. Right now, being able to edit the view from one interface is worth its weight in gold.
And making views functionality theme dependent would be crazier.
Comment #11
netw3rker commented