2
我想從數組中值以下都嘗試
print $node->field_equiryform_custmessage[0][0];
和
print $node->field_equiryform_custmessage[0]['value'];
我在做什麼錯?
由於
我想從數組中值以下都嘗試
print $node->field_equiryform_custmessage[0][0];
和
print $node->field_equiryform_custmessage[0]['value'];
我在做什麼錯?
由於
在Drupal 7的字段陣列現在包裹着一個語言元素(在輸出的上述und
裝置未定義,如在未定義語言)。
您可以訪問字段的值或者使用und
作爲數組鍵或(最好)使用LANGUAGE_NONE
常數:
print $node->field_equiryform_custmessage[LANGUAGE_NONE][0]['value'];
如果你正在運行一個多語言系統,它看起來更像是這樣的:
print $node->field_equiryform_custmessage[$node->language][0]['value'];
後者可能實際上是這樣做的更具前景的方式。