0

我的内容类型,计划拥有一个或多个“地图”。

使用以下 php 代码,我可以获取他们的所有链接:

 <?php  print render($content['field_mappe_di_riferimento']); ?>

我得到以下结果:

在此处输入图像描述

我想在链接之前放置内容类型“Mappa”中的图像,在“field_immagine_min”字段中输入。

这是我的内容类型的结构:

在此处输入图像描述

这是内容类型“Mappa”:

在此处输入图像描述

与:“print_r($field_mappe_di_riferimento);” 我得到它:

Array ( [0] => Array ( [nid] => 30 [access] => 1 [node] => stdClass Object ( [vid] => 30 [uid] => 1 [title] => Carta di Marignano, primo giorno, 13 Settembre 1515 [log] => [status] => 1 [comment] => 1 [promote] => 1 [sticky] => 0 [nid] => 30 [type] => mappa [language] => en [创建] => 1352066743 [更改] => 1352127342 [tnid] => 0 [翻译] => 0 [revision_timestamp] => 1352127342 [revision_uid] => 1 [field_battaglia_di_riferimento] => 数组 ([und] = > 数组 ( [0] => 数组 ( [nid] => 2 ) ) ) [field_immagine_std] => 数组 ( [und] => 数组 ( [0] => 数组 ( [fid] => 23 [alt] = > [标题] => [宽度] => 672 [高度] => 554 [uid] => 1 [文件名] =>polesella.jpg [uri] => public://polesella_0.jpg [filemime] => 图片/jpeg [文件大小] =>337755 [状态] => 1 [时间戳] => 1352066743 [rdf_mapping] => 数组 ( ) ) ) ) [field_immagine_min] => 数组 ( [und] => 数组 ( [0] => 数组 ( [fid] => 24 [alt] => [title] => [width] => 150 [height] => 110 [uid] => 1 [filename] =>polesella_small.jpg [uri] => public://polesella_small.jpg [ filemime] => image/jpeg [filesize] => 10672 [status] => 1 [timestamp] => 1352066743 [rdf_mapping] => Array ( ) ) ) ) [field_testo_opzionale] => Array ( [und] => Array ( [0] => Array ([value] => pisello [format] => [safe_value] => pisello) ) [rdf_mapping] => Array ([rdftype] => Array ([0] => sioc:Item24 [alt] => [title] => [width] => 150 [height] => 110 [uid] => 1 [filename] =>polesella_small.jpg [uri] => public://polesella_small.jpg [ filemime] => image/jpeg [filesize] => 10672 [status] => 1 [timestamp] => 1352066743 [rdf_mapping] => Array ( ) ) ) ) [field_testo_opzionale] => Array ( [und] => Array ( [0] => Array ([value] => pisello [format] => [safe_value] => pisello) ) [rdf_mapping] => Array ([rdftype] => Array ([0] => sioc:Item24 [alt] => [title] => [width] => 150 [height] => 110 [uid] => 1 [filename] =>polesella_small.jpg [uri] => public://polesella_small.jpg [ filemime] => image/jpeg [filesize] => 10672 [status] => 1 [timestamp] => 1352066743 [rdf_mapping] => Array ( ) ) ) ) [field_testo_opzionale] => Array ( [und] => Array ( [0] => Array ([value] => pisello [format] => [safe_value] => pisello) ) [rdf_mapping] => Array ([rdftype] => Array ([0] => sioc:ItemArray ( [value] => pisello [format] => [safe_value] => pisello ) ) ) [rdf_mapping] => Array ( [rdftype] => Array ( [0] => sioc:ItemArray ( [value] => pisello [format] => [safe_value] => pisello ) ) ) [rdf_mapping] => Array ( [rdftype] => Array ( [0] => sioc:Item1 => foaf:Document ) [title] => Array ( [predicates] => Array ( [0] => dc:title ) ) [created] => Array ( [predicates] => Array ( [0] =>直流:日期11 [comment_count] => 0 [name] => ant [picture] => 0 [data] => b:0; ) ) )

所以我尝试获取要拍照的节点的nid,成功:

  print ($content['field_mappe_di_riferimento']['#items'][0][nid]);

我得到30...

4

1 回答 1

0

我找到了解决方案:

$array = $content['field_mappe_di_riferimento']['#items'];

$k = 0;


foreach($array as $k => $v){

  print($k);

  //carico il nodo
  $node = node_view(node_load($content['field_mappe_di_riferimento']['#items'][$k]['nid']));

   //stampa l'img del nodo
   print render($node['field_immagine_min']);

  }
于 2012-11-08T10:36:47.930 回答