滚动
不同颜色的标题
论坛
需要将颜色的十六进制代码插入到HTML代码中的field_color字段所对应的位置。
我在网站模板中准备了这样的代码:
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1 style="color: #<?php echo $Set_color; ?>;" id="page-title"><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
总之,我不明白如何将$Set_color替换为字段field_color的内容,当然之后要放入预先准备好的 <h1 style="color: #<?php echo $Set_color; ?>;" id="page-title"><?php print $title; ?></h1>。
我在开始时写了以下代码
// 加载节点
$node = node_load($nid);
// 获取字段值
$Set_color = $node->field_color[$node->language]['0']['value'];
但是没有任何输出。
我该如何输出这个值?
- 登录 发表评论