2011-04-11 132 views
0
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(); 
........ 

现在我想添加<br/><span class="pollunm">围绕</span>。我把这段代码放在我的主题template.php中,但它不输出span标签。为什么覆盖没有输出?

function mytheme_preprocess_rate_template_emotion(&$variables) { 
$link['votes']='<br/><span class="pollunm">'.$link['votes'].' </span>'; 
} 

+0

你的主题叫做'mytheme'吗?如果不将“mytheme”更改为任何主题的名称(主题文件夹中的.info文件)。您是否已在管理员的“效果”部分清除了缓存的数据? – 2011-04-11 11:45:47

+0

yeap,主题文件被称为mytheme,我清除了缓存。 – zhuanzhou 2011-04-11 12:02:31

+0

是mytheme_preprocess_rate_template_emotion()真的叫做_before_ rate_preprocess_rate_template_emotion()吗? – gpilotino 2011-04-11 13:30:00

回答

0

这不是一个解决方案。只是你调试的步骤。

  1. 首先确保function mytheme_preprocess_rate_template_emotion(&$variables)通过在函数中放入dpm(install devel module)来调用。他们使用foreach ($links as $link)。因此,确保你是否想要为所有链接做到这一点只是一个链接。
  2. function mytheme_preprocess_rate_template_emotion(&$variables)之内放了一个dpm($ variables);并找出哪些是您可以使用的变量以及它们的值是什么。它可能会帮助你。
相关问题