Drupal 7 でサブテーマを作成し、残りのコンテンツが通常ある場所の外にあるカスタム コンテンツ タイプからpage.tpl.php
値 (プレーン テキスト) を取得する必要があります。field_EXAMPLE
<!-- Adding $title as normal-->
<?php print render($title_prefix); ?>
<?php if (!empty($title)): ?>
<h1><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<!-- THE ISSUE: Adding field_EXAMPLE -->
<h2> <?php print render($field_EXAMPLE;);?> </h2>
...
<!-- Where the rest of the content loads by default -->
<div><?php print render($page['content']); ?></div>
うまくいくでしょうかfield_get_items
?
function field_get_items($entity_type, $entity, $field_name, $langcode = NULL) {
$langcode = field_language($entity_type, $entity, $field_name, $langcode);
return isset($entity->{$field_EXAMPLE}[$langcode]) ? $entity->{$field_name}[$langcode] : FALSE;
}
それともこれ?
$node = node_load($nid);
$node->field_EXAMPLE[$node->language][0]['value'];
これ入れpage.tpl.php
ますか?それらを試してみましたが、サイコロはありません。-初心者
これが var_dump(get_defined_vars()); です。
["field_thestring"]=>
array(1) {
["und"]=>
array(1) {
[0]=>
array(3) {
["value"]=>
string(44) "This is a string of text please refer to me "
["format"]=>
NULL
["safe_value"]=>
string(44) "This is a string of text please refer to me "
}
}
}