开发者

Pull field values of Drupal Views Custom Field $data variable?

In Drupal 6, I'm using the Views Custom Field module to insert some php into my View. The helper text in the php CustomField reads:

$data: contains the retrieved record from the database (e.g. $data->nid).

开发者_高级运维

Okay... seems pretty straightforward. So, I have a custom field named field_short_title that's being output in the view. Now how do I pull that value out of the $data variable? I've tried the following, but no luck:

$data->field_short_title

$data->field_short_title_value

$data->node_data_field_short_title.field_short_title_value

Surely this is just some kind of Drupal syntax error on my part... right?


Ahh... I used <?php print_r ($data) ?> to see what's going on with that $data variable. Here's what I was looking for:

node_data_field_short_title_field_short_title_value 

So the whole thing looks like this:

<?php echo $data->node_data_field_short_title_field_short_title_value ?>

Intuitive, isn't it? Sigh...


Use print_r($data) It will shows all view field machine name, You can use that name in your PHP code Now you can get view field values where ever you want..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜