2011-04-11 9 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">을 추가하고 싶습니다. 이 코드를 내 테마 template.php에 넣습니다. 그러나 span 태그를 출력하지 않습니다.왜 덮어 쓰기에 출력이 없습니까?

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

+0

테마는 'mytheme'입니까? 'mytheme'을 테마가 호출 된 곳으로 변경하지 않습니다 (테마 폴더의 .info 파일). 관리자의 '성능'섹션에서 캐시 된 데이터를 삭제 했습니까? –

+0

yeap, 테마 파일은 mytheme이고 캐시를 지 웠습니다. – zhuanzhou

+0

은 정말 _before_rate_preprocess_rate_template_emotion()이라고하는 mytheme_preprocess_rate_template_emotion()입니까? – gpilotino

답변

0

이는 해결책이 아니다. 디버깅 할 수있는 단계.

  1. 먼저 function mytheme_preprocess_rate_template_emotion(&$variables)이 dpm (install devel 모듈)을 함수에 추가하여 호출되는지 확인하십시오.
  2. function rate_preprocess_rate_template_emotion(&$variables) 안에는 foreach ($links as $link)이 사용됩니다. 따라서 모든 링크에 대해이 링크를 수행할지 여부는 단 하나의 링크 여야합니다.
  3. function mytheme_preprocess_rate_template_emotion(&$variables) 내에 dpm ($ 변수)을 넣습니다. 사용할 수있는 변수와 그 값은 무엇인지 알아보십시오. 도움이 될지도 모릅니다.
관련 문제