Closed (outdated)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
27 Feb 2011 at 19:58 UTC
Updated:
19 Jan 2017 at 11:08 UTC
Jump to comment: Most recent
Comments
Comment #1
dawehnerIn general blocks doesn't see the arguments from url by default. This is how views works.
To be able to use arguments from url in blocks you should use select "provide default argument" and select for example "node: nid from url".
Comment #2
nrdmagnus commentedTrue. I've worked with all Views versions for D6 and block displays have always been defective in arguments handling.
Now about your suggestion, I'm already using Provide default argument, but together with Taxonomy Term ID from URL option (as the argument is a taxonomy term). The result you've read above.
I've also tried configuring it to Provide default argument combined with the PHP Code option, providing a code snap (pasted ahead) that is already working in the template.php. Again, in Block display Live preview everything worked fine but in the actual block no filtering at all.
So my point with this issue is if Block display is planned to accept arguments:
And, please, don't get me wrong here. I do think that Views module is a insanely great piece of work!
P.S.: The argument handling PHP code:
Comment #3
dawehnerIf you want to produce much easier(so also code with less bugs) i recommend you to load the node via
on a page like "node/123"
or if you are on a "taxonomy/term/123" page
Comment #4
nrdmagnus commentedI think you didn't understand the purpose of this code snippet. Both of your suggestions don't deal with text arguments passed to a view through a path alias (URL).
Anyway the error probably isn't there (as I said before the snippet is working fine in template.php). This was just a test to verify if the problem was with the Taxonomy Term ID from URL option.
In fact both are responding the same way (results and problems) in this case.
Comment #5
nrdmagnus commentedSorry about the wrong PHP code above. It was part of a bigger code and I didn't make the necessary ajustment.
Here goes the working code to get a text argument (representing a taxonomy term) from any URL (node, taxonomy, view, ...) and pass to a view, even on Block display:
The view argument can be any text field, but the validation here is handled exclusively by Taxonomy module.
Always here to help.
Comment #6
dawehnerThat's still not a bug report :)
There is a good reason why it's much easier to use $node = menu_get_object() and load the data for yourself.
Comment #7
jaron commentedIs there anyway to load a nodequeue machine title as an argument into a block? I can obviously get it into a page display but I can't figure out a way to build that into the php of a block. Any guidance one way or the other would be appreciated.
Thanks.
Comment #8
mustanggb commentedClosing this as outdated, feel free to re-open if you're still looking for a solution and waiting for appropriate assistance.