By mas_master on
Hi!
I'm a beginer in php studying, so I ask anybody please help me.
I have created a gmap style block view and I want to show on that map some locations depends on current node.
As I understood in Default argument type: "PHP argument code" we should operate with parameters of currents page (in my case it is a node with a path - node\%) and then return one of such parameters as an argument. Am I right ?
If I'm right my question is:
Is there any possibility to get parameters of current node ( node type, node term, node user and so on) to operate with them in Default argument type: "PHP argument code" and then return as parameter?
Thank you for any advice!
Comments
Yes, pick "Node: nid" as
Yes, pick "Node: nid" as the argument type and on the setting form pick the appropriate options. With view 2 no PHP code is needed.
Basic setting for "Node: nid" for block style view
Thank you, nevets! I know
Thank you, nevets!
I know such method.
Actually I didn't formulate my question well:
Is there any possibility to get parameters of current node ( node type, node term, node user and so on) by using php code in "PHP argument code", to operate with them and then return as ARGUMENT?
It would be great if I had some examples of PHP code usage in Default argument type: PHP Code. So that I could understand the opportunities of that feature.
Yes, there is the
Yes, there is the possibility though it depends on what you want to do. To start with there needs to be an argument type that corresponds to what you want to return (For example "Node: Type"). So using "Node: Type" as an example
In general the line
return $node->title;would need to reflect the argument type selected.This is exactly what I
This is exactly what I needed. Thank you!
Thanks!
This is exactly what I needed to display contact information on the side of my client's website, relative to the node which had the general information about the building.
Awesome stuff.
Thanks!
You have explained it very clearly.