为什么覆盖没有输出?
function rate_preprocess_rate_template_emotion(&$variables) {
extract($variables);
$buttons = array();
foreach ($links as $link) {
$button = theme('rate_button', $link['text'], $link['href'], 'rate-emotion-btn');
$button .= $link['votes'];
$buttons[] = $button;
}
$variables['buttons'] = $buttons;
$info = array();
........
现在我想在 周围添加
。我将此代码放入我的主题 template.php
中。但它不输出 span 标签。
<代码>
function mytheme_preprocess_rate_template_emotion(&$variables) {
$link['votes']='<br/><span class="pollunm">'.$link['votes'].' </span>';
}
<代码>
function rate_preprocess_rate_template_emotion(&$variables) {
extract($variables);
$buttons = array();
foreach ($links as $link) {
$button = theme('rate_button', $link['text'], $link['href'], 'rate-emotion-btn');
$button .= $link['votes'];
$buttons[] = $button;
}
$variables['buttons'] = $buttons;
$info = array();
........
now i want to add <br/><span class="pollunm">
around the </span>
. i put this code in my theme template.php
.but it doesn't output the span tags.
function mytheme_preprocess_rate_template_emotion(&$variables) {
$link['votes']='<br/><span class="pollunm">'.$link['votes'].' </span>';
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是一个解决方案。只是您调试的步骤。
函数rate_preprocess_rate_template_emotion(&$variables)
内部,他们使用foreach ($links as $link)
。因此,请确保您是否要对所有链接执行此操作,而仅对其中一个链接执行此操作。This is not a solution. Just the step for you to debug.
function mytheme_preprocess_rate_template_emotion(&$variables)
is getting called by putting a dpm(install devel module) in the function.function rate_preprocess_rate_template_emotion(&$variables)
they are usingforeach ($links as $link)
. So make sure that whether you want to do it for all links are just one link.function mytheme_preprocess_rate_template_emotion(&$variables)
put a dpm($variables); and find out which are the variables available to you and what are their values. It might help you.