0

这就是我的内容类型看起来像图像 的最佳方式是什么?我以前使用过视图和视图-字段-集合-项目。但我只是无法获得第三个字段集合值,即根据图像的收入信息。

请提出一个最好的方法来主题这个内容类型!

4

1 回答 1

0

我建议使用模板,根据需要设置样式要容易得多。这是您的特定情况的示例:

<?php
  $field_nation = field_get_items('node', $node, 'field_nation');
  foreach ($field_nation as $nation) {
    $fc = field_collection_field_get_entity($nation);

    // Nation name
    $field_nation_name = field_get_items('field_collection_item', $fc, 'field_nation_name');
    $field_nation_name = $field_nation_name ? $field_nation_name[0]['value'] : '';


    // Another nested field collection
    $field_companies_info = field_get_items('field_collection_item', $fc, 'field_companies_info');

    foreach ($field_companies_info as $company) {
        $fc2 = field_collection_field_get_entity($company);

        // Company name inside second field collection
        $field_company_name = field_get_items('field_collection_item', $fc2, 'field_company_name');
        $field_company_name = $field_company_name ? $field_company_name[0]['value'] : '';

        // Industry inside second field collection
        $field_industry = field_get_items('field_collection_item', $fc2, 'field_industry');
        $field_industry = $field_industry ? $field_industry[0]['value'] : '';

        // Another nested field collection for Revenue information
        $field_revounue_info = field_get_items('field_collection_item', $fc2, 'field_revounue_info');
        // ..... And here another foreach similar to those above
    }

  }
?>
于 2016-05-12T09:45:50.940 回答