Quantcast
Channel: memo »カスタムフィールド
Viewing all articles
Browse latest Browse all 3

drupal CCKで追加したカスタムフィールドの値を取り出す方法

$
0
0

任意のノードテンプレート(node-example.tpl.php)に以下を追加。

プレーンな内容を出力する場合

<?php print $field_フィールド名[0][value]; ?>

フォーマット済みの内容を出力する場合

<?php print $field_フィールド名[0][safe]; ?>
<?php print $field_フィールド名[0][view]; ?>

↑どう違うんやろ?調べる

このままだとダブって表示されることになるので、$contentからカスタムフィールドの値を取り除く。↓

管理セクション>コンテンツの管理>コンテンツタイプ>manage fields>フィールドの表示
で、「Exclude」にチェック


Viewing all articles
Browse latest Browse all 3

Trending Articles