【问题标题】:Adding html to t() in Drupal 6 template.php?在 Drupal 6 template.php 中将 html 添加到 t()?
【发布时间】:2013-05-14 18:11:50
【问题描述】:

您好,我正在尝试将 html 添加到“t('Older Posts')”和“t('Newer Posts')”这可能吗?我能猜出来吗??? 我在 Drupal 6 template.php 文件中。

这是我尝试添加为 html 的代码 -

 <a href="" class="action"><span>Newer Posts</span></a>
 <a href="" class="action back"><span>Older Posts</span></a>

我需要在下面完整功能中的这些位置替换上面的内容吗?

 t('Older Posts')
 t('Newer Posts')

我想创造这样的东西

 t('<a href="" class="action back"><span>Older Posts</span></a>')
 t('<a href="" class="action"><span>Newer Posts</span></a>')

功能齐全

 function theme_views_mini_pager($tags = array(), $limit = 10, 
 $element = 0,  $parameters = array(), $quantity = 9) {      
 global $pager_page_array, $pager_total;

 // Calculate various markers within this pager piece:
 // Middle is used to "center" pages around the current page.
 $pager_middle = ceil($quantity / 2);
 // current is the page we are currently paged to
 $pager_current = $pager_page_array[$element] + 1;
 // max is the maximum page number
 $pager_max = $pager_total[$element];
 // End of marker calculations.


$li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : 
t('Older Posts')), $limit, $element, 1, $parameters);
 if (empty($li_previous)) {
$li_previous = "&nbsp;";
}

$li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('Newer Posts')), 
$limit,$element, 1, $parameters);
if (empty($li_next)) {
$li_next = "&nbsp;";
}

if ($pager_total[$element] > 5) {
$items[] = array(
  'class' => 'action back pager-previous',
  'data' => $li_previous,
);

$items[] = array(
  'class' => 'action pager-next',
  'data' => $li_next,
);
return theme('item_list', $items, NULL, 'ul', array('class' => 'pager'));
}
}

我想弄清楚这是否可能我已经尝试了很多东西,但还没有任何效果。

【问题讨论】:

标签: php drupal drupal-views drupal-themes


【解决方案1】:

你可以使用

$link = '<a href="" class="action back"><span>' . t('Older Posts') . '</span></a>';

$link = t('!link_startOlder Posts!link_end', array(
  '!link_start' => '<a href="" class="action back"><span>',
  '!link_end' => '</span></a>',
));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多