开发者

Comment $links order in drupal

In the comment.tpl, $links is printed to show the reply and edit link. In my theme, edit comes before reply. How do you change 开发者_如何学Pythonthe order of the printed links?


Check out hook_link_alter() - it allows you to manipulate the links before they get rendered, e.g. remove some or change the order.


Try creating a comment preprocess function in template.php in your theme. That should give you access to the $links variable and allow you to re-order the elements.


This function will reverse the order of comment links. Put it in your template.php (also after adding the function empty your site caches and visit /admin/build/themes once to make sure this function is picked up in the theme registry):


function phptemplate_links($links, $attributes = array('class' => 'links')) {
  if (isset($links['comment_edit'])) {
    krsort($links); // or ksort if you want to order your links the other way
  }
  return theme_links($links, $attributes);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜