views:

39

answers:

2

Hi friends,

I'm a drupal newbie (mean it :)

I have a Block, created with View Module. and this block content has CCK fields. I display any of field with Fields Box in View Module. It's cool.

the issue is, one of the CCK field has a condition value for linking at homepage or not. So I need to get the value of field_homepage_linking CCK field value, and saying

  • if it is 1, displaying the link for the current record,

  • if not, just listing the title.

I installed the http://drupal.org/project/views_customfield module, now I can write php in Block View. I tried

$node->field_homepage_linking["0"]["view"]

$node->field_homepage_linking["0"]["value"]

value_get('field_homepage_linking')

but can't get the value! :/ how can I get the value?

Appreciate helps so much!! thanks a lot!!

A: 

i'm not totally sure if i get what you're trying to do, but you have to make sure the $node object points to something valid.

generally speaking, if you would print the $node in the page.tpl.php or node.tpl.php you'd get a result. in most other cases you'd have to use the node_load() function (http://api.drupal.org/api/function/node_load/6) to get the node object.

30equals
A: 

SORTED http://drupal.org/node/467190#comment-2068324

artmania