Этот код добавляет пейджер для пролистывания страниц с комментариями. Стандартно, если количество комментариев превысит указанное, то пейджер добавляется только под комментариями. Это не совсем удобно, а выбора расположения ссылок в параметрах нет. Вставьте этот код в файл template.tpl.php и пейджер будет появляться как над, так и под комментариями.
function phptemplate_comment_wrapper($content) {
$comments_per_page = _comment_get_display_setting('comments_per_page');
$content = theme('pager', NULL, $comments_per_page, 0) . $content;
return theme_comment_wrapper($content);
}
function phptemplate_comment_wrapper($content, $node) {
$comments_per_page = _comment_get_display_setting('comments_per_page', $node);
$content = theme('pager', NULL, $comments_per_page, 0) . $content;
if (!$content || $node->type == 'forum') {
return '<div id="comments">'. $content .'</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}
template.php:
function mytemplate_preprocess_comment_wrapper(&$vars) {
$vars['top_pager'] = theme('pager');
}
comment-wrapper.tpl.php:
<?php if (isset($top_pager)): ?>
<div class="top_pager">
<?php print $top_pager; ?>
</div>
<?php endif; ?>
Комментарии
Хм, вообще после вставки любой функции название которой начинается на phptemplate_ сайт перестаёт работать
Для 6-рки:
function colourise_comment_wrapper($content, $node) {
if (!$content || $node->type == 'forum') {
$comments_per_page = _comment_get_display_setting('comments_per_page');
$content = theme('pager', NULL, $comments_per_page, 0) . $content;
return '<div id="comments">'. $content .'</div>';
}
else {
$comments_per_page = _comment_get_display_setting('comments_per_page');
$content = theme('pager', NULL, $comments_per_page, 0) . $content;
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}