By bg1 on
I am a Drupal newbie trying to get a relatively simple View Block to work.
I have a page for an object (e.g. Manufacturer) and I have a block in the side panel for that Manufacturer's products. My View works fine, if it gets the parameter.
How do I pass the page nodeID parameter to the block and thereby to the View for that block. A simple example would be great.
Thanks in advance for any assistance.
Comments
You need an argument. Add
You need an argument. Add one, select Node: Nid, under Action to take if argument is not present: select Provide default argument (typically the argument is not "present" for a block display), Default argument type: is Node ID from URL, choose Node validator if you want and then you can restrict to certain content types if you want.
gpk
----
www.alexoria.co.uk
Is argument a session variable or user-defined variable?
Thanks for the suggestion.
The help says: "Block displays have no source of arguments at all; they cannot pull arguments from the URL, and often require use of the default argument PHP code in order to get arguments."
I am assuming that the PHP code either refers to a session variable or one needs to also put some PHP code on the page to populate some variable with the page nodeID.
What might the PHP code look like (I am a programmer, but not familiar with PHP but I should be able to figure it out with an example).
Thanks again for your assistance.
>often require use of the
>often require use of the default argument PHP code in order to get arguments
Not very well worded I think. The necessary "default argument PHP code" is activated I think if you follow the instructions I gave. You shouldn't need to do anything else.
gpk
----
www.alexoria.co.uk
It works! Thanks.
I went back and tried: Default argument type: is Node ID from URL again. It works! I must have had some other setting going the first time I tried that which was blocking it.
Thanks again.
:-)
:-)
gpk
----
www.alexoria.co.uk
Thank you
Very short and instructive reply, gpk.
Thank you, it saved me a lot of time.
In my case under Drupal 7.15 I use Panels 3 to display a Page with several node fields and a Views 3 block with content, related to this node.
Provide default value with a ContentID from URL works like a charm.
Screenshots: view, block, panel, result.
What we know shapes who we are.