或者通过合作网站直接登录猪跑啦
用新浪微博登陆
用QQ账号登陆
用文本列表类型的字段做了个联动
然后我用presave钩子保存时 保存到该表的value里面
出现来效果如下
请问怎么把这个字段显示出来的ID改为这个ID对应的title
最直接的方法是在node.tpl.php 上做修改,默认在node.tpl.php 显示内容是下面代码
<?php // We hide the comments and links now so that we can render them later. hide($content['comments']); hide($content['links']); print render($content); ?>
可以改成这样:
<div class="content"<?php print $content_attributes; ?>> <div class="cases-images"><?php print render($content['field_image']);?></div> <div class="cases-info"> <p><strong>网站名称:</strong><?php print $title; ?></p> <p><strong>网站地址:</strong><a href="<?php print render($content['field_link']); ?>" target="_blank"><?php print render($content['field_link']); ?></a></p> <p><strong>网站核心:</strong><?php print render($content['field_core']); ?></p> <p><strong>网站性质:</strong><?php print render($content['field_sitetype']); ?></p> <p><strong>网站站长:</strong><?php print render($content['field_sitemanager']); ?></p> <p><strong>所用模板:</strong><?php print render($content['field_theme']); ?></p> <p><strong>所用模块:</strong><?php print render($content['field_module']); ?></p> <p><strong>网站简介:</strong><?php print render($content['field_description']); ?></p> </div> </div>
就是每个字段的输出,那么假使你的优惠劵的字段名称叫:field_coupon, 你可以在后台内容类型中管理显示中对 field_coupon 进行输出设置,选择“纯文本”
然后在node.tpl.php这么输出:
<?php print your_custom_function(render($content['field_coupon'])); ?>
再写一个函数用这个函数处理,读出id对应的title
function your_custom_function($cid){ $output = ''; //do sth return $output; }
使用 views 的覆写,可以轻松搞定
字段里添加 title ,然后排除显示
2 个回答
最直接的方法是在node.tpl.php 上做修改,默认在node.tpl.php 显示内容是下面代码
可以改成这样:
就是每个字段的输出,那么假使你的优惠劵的字段名称叫:field_coupon, 你可以在后台内容类型中管理显示中对 field_coupon 进行输出设置,选择“纯文本”
然后在node.tpl.php这么输出:
再写一个函数用这个函数处理,读出id对应的title
分头诗人Lv 17
使用 views 的覆写,可以轻松搞定
字段里添加 title ,然后排除显示
13026Lv 1