I am trying to reach a field in a content type from panels by adding custom content. I can of course add the field in the panel , but I just want the variable in a custom content which is a link. And from there create a button which sends the user on to the link from the variable.

In page-tpl.php I can reach the variable in the array through:

$node->field_my_field[0]["url"]

but this doesn't work in panels custom content with input form PHP.

Thanks,
Any ideas?

Comments

johangustafsson’s picture

Nevermind, I found it.

Choose PHP as input format.

This command fetches the node content into a php usable variable.

$node = node_load(%node:nid);

From there it's easy to do just about anything with any content in the node.

/ Johan

arlind’s picture

Hi Johan,

I can't get it to work - could You paste som code that works?

Where did You find this information?

thanks
Bo :-)