stdClass Object(
[nid] => 98
.......
[title] => hello world!
[body] =>
........
[field_img] => Array(
[0] => Array(
[fid] => 200
[list] => 1
[data] => Array(
[alt] =>
[title] =>
)
[uid] => 1
[filename] => coupon.jpg
[filepath] => sites/default/files/coupon_0.jpg
[filemime] => image/jpeg
[filesize] => 4434
[status] => 1
[timestamp] => 1302080050
[nid] => 98
[view] => **the image**
......
)
)
)
オブジェクトが$test
であるとすると、echo $test->field_img[0]["timestamp"]
のviews-view-fields.tpl.php
は1302080050
を出力しますが、echo $test->field_img[0]["nid"]
とecho $test->field_img[0]["view"]
は何も出力しません。 98と画像が印刷できません。 print_r($test->field_img[0])
はノードIDとview
を出力しませんか?どうして?
ビューテンプレートファイルでは、次のオブジェクトにアクセスできます。
$row
$fields['field_my_field_value']->row
$fields['field_my_file_value']->content
あなたの場合、複数の画像オブジェクトにアクセスすることはできません。各アイテムのデータを取得するには、外部関数を呼び出す必要があります。
$arg = (object) array(
'type' => $fields['type']->raw,
'vid' => $fields['vid']->raw,
);
$files = filefield_get_node_files($arg);
foreach ($files as $file) {
print theme('imagecache', 'preview_body', $file['filepath']);
}