Drupal 7 Drupal 7:change";阅读更多“;关于内容类型摘要

Drupal 7 Drupal 7:change";阅读更多“;关于内容类型摘要,drupal-7,teaser,Drupal 7,Teaser,在内容类型的摘要中,如何更改“阅读更多”链接按钮的文本?通过将此代码放置在主题的template.php文件中覆盖节点输出(替换为YourThemeName,yourtcontenttype和NewReadMoreText以及主题名称和所需的阅读更多文本) <?php // Preprocess variables for node.tpl.php. function YourThemeName_preprocess_node(&$variables) { // Let's

在内容类型的摘要中,如何更改“阅读更多”链接按钮的文本?

通过将此代码放置在主题的template.php文件中覆盖节点输出(替换为
YourThemeName
yourtcontenttype
NewReadMoreText
以及主题名称和所需的阅读更多文本)

<?php
// Preprocess variables for node.tpl.php.
function YourThemeName_preprocess_node(&$variables) {
  // Let's get that read more link out of the generated links variable!
  unset($variables['content']['links']['node']['#links']['node-readmore']);

  // Now let's put it back as it's own variable! So it's actually versatile!
  if ($variables['type'] == 'YourContentType') {
  $variables['newreadmore'] = t('<span class="YourContentTypereadmore"> <a href="!title">NewReadMoreText</a> </span>',
      array('!title' => $variables['node_url'],)
   );
  } else {
      $variables['newreadmore'] = t('<span class="newreadmore"> <a href="!title">Read More </a> </span>',
      array('!title' => $variables['node_url'],)
   );
  }

  $variables['title_attributes_array']['class'][] = 'node-title';
}
?>

这是最基本的修复方法。我所做的只是转到我的www dir和grep-r“readmore”,对我来说它位于modules/node/node.module中,然后我制作了一份文件的副本,并将其更改为“Load more”,以满足我的需要:if($view_mode=='striser'){$node_title=strip_tags($node->title);$links['node-readmore']=array('title'=>t)('Load more about@title',array('@title'=>$node\u title\u stripped)),'href'=>'node/'.$node->nid,'html'=>TRUE,'attributes'=>array('rel'=>'tag','title'=>$node\u title\u stripped),;)