hi,

just realized there arent any pagers for me to goto a new page. would be great if it could be on the top and bottom of a topic.

thanks!

Comments

Michelle’s picture

#240176: Add pagination to top of forum topic is the D6 issue for this. I'll leave it up to Troky if he wants to tackle it in D7 2.x. I will likely be able to do it in 3.x but am not planning to try in 2.x.

Michelle

troky’s picture

I am not sure I understand what is the real problem here: pager not displayed on top of a topic or not displayed at all?

If you want pager displayed on top of a topic quick fix is to add:

<?php print theme('pager'); ?>

to advanced-forum.naked.topic-header.tpl.php

Michelle’s picture

I don't know if things have changed in D7 but it's not that simple in D6. The pager is tied to the query and the query isn't available there unless you rerun it, which will double the load time.

Michelle

troky’s picture

Well, solution from #2 works for me without any other modifications.

Michelle’s picture

Interesting... Something must have changed in D7, then. Glad to know what was once a horribly complex problem has been made simpler. :)

Michelle

patoshi’s picture

beautiful... thanks! ill be contributing more bug reports.. i guess not many people are adopting D7 yet since this basic necessity wasnt implemented. great work tho! i would love to contribute, but i havent even developed a module yet.. i do alot of theming and could do some php..

troky’s picture

Status: Active » Fixed

$pager variable added to topic-header template.

Proper way to display pager in topic-header template would be:

<?php print($pager); ?>
patoshi’s picture

I only see the pagers in forum view but not in topic view. Do I need to add some code manually?

troky’s picture

Pager should be visible on the bottom of topic view page. What style do you use?

patoshi’s picture

The forum style is Silver Bells.

troky’s picture

Can you send some screenshot(s)? I don't see any problems with silver bells style.

patoshi’s picture

just switched to blue lagoon .. see here: http://prntscr.com/22817

patoshi’s picture

i do see the pager on the topic list view.

troky’s picture

what about bottom of page?

patoshi’s picture

nothing.. screen shot: http://prntscr.com/22dim

what could it be ? how would u like me to debug.

Michelle’s picture

Status: Fixed » Postponed (maintainer needs more info)

Are there more replies after that one? What do you have your replies per page set to? I think it defaults to 30, which would mean you don't have enough to have a second page, yet, if that's the end of them.

The other possibility is something is interfering with the comment wrapper preprocessing. That happens now and then in D6 and may still be an issue in D7.

Michelle

patoshi’s picture

There are over 50 replies in that topic. I have it set to 30 now.

patoshi’s picture

where is the comment wrapper preprocessing located?

troky’s picture

advanced_forum_preprocess_comment_wrapper() in includes/theme.inc

... but I don't think there's your problem. You should try to disable some of modules that could mess with forum.

Also, you could send me (private) link to your forum pages so I can check it out.

Michelle’s picture

@troky: I don't know if it affects D7, but I had problem with various themes and sometimes even modules that would have their own comment wrapper stuff that clobbered the preprocess. Even Garland did, but I think that's been fixed, now. So I would check that the AF template is even being used by sticking a bit of text in it and clearing the cache.

Michelle

troky’s picture

Here is comment-wrapper.tpl comparison:

Original:

<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php if ($content['comments'] && $node->type != 'forum'): ?>
    <?php print render($title_prefix); ?>
    <h2 class="title"><?php print t('Comments'); ?></h2>
    <?php print render($title_suffix); ?>
  <?php endif; ?>

  <?php print render($content['comments']); ?>

  <?php if ($content['comment_form']): ?>
    <h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
    <?php print render($content['comment_form']); ?>
  <?php endif; ?>
</div>

AF7 naked (needs tiny adaptation to above):

<div id="forum-comments" class="<?php print $language->language; ?>">
  <?php print render($content['comments']); ?>
  <?php if ($content['comment_form']): ?>
    <h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
    <?php print render($content['comment_form']); ?>
  <?php else: ?>
    <?php print $reply_link; ?>
  <?php endif; ?>
</div>

AF7 custom template with (bottom) pager disabled. Pager is displayed like described in #7:

<div id="forum-comments" class="<?php print $language->language; ?>">
  <?php
    hide($content['comments']['pager']);
    print render($content['comments']);
  ?>
  <?php if ($content['comment_form']): ?>
    <h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
    <?php print render($content['comment_form']); ?>
  <?php else: ?>
    <!--<ul class="topic_buttons"><?php print $reply_link; ?></ul>-->
  <?php endif; ?>
</div>

Pager is set in core comments module so that's why I don't see any problem with AF.
AF comment-wrapper.tpl IS actually used. Tested.

Michelle’s picture

"Pager is set in core comments module so that's why I don't see any problem with AF."

Doh! Ok, ignore all my comments and I'm sorry for getting things off track. For some reason I was mixing the pager with the reply button that AF adds. I have no idea why... Just a brain slip, I guess.

Michelle

patoshi’s picture

hi troky.. PMed u a login/pass to my site for u to check out. thanks!

troky’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
btweedy’s picture

Status: Closed (fixed) » Active

I am also experiencing this. I put in the following code in advanced-forum.naked.topic-header.tpl.php

<?php if (!empty($pager)) { 
print $pager;
} else {
echo "No Pager";
}?>

It always displays "No Pager" regardless of how many comments are on the thread. That makes me think the $pager variable is just not getting passed to the template. I, unfortunately, do not know enough to try to troubleshoot it any more.

btweedy’s picture

Version: 7.x-2.x-dev » 7.x-2.0
btweedy’s picture

Any updates to this?

troky’s picture

Status: Active » Closed (cannot reproduce)

Sorry. Can't reproduce this so debugging is impossible.

wfragakis’s picture

Hope this helps someone add pagination to the bottom of the comments on each page. I am using silver bells based on naked.

In advanced_forum/includes/theme.inc

function advanced_forum_preprocess_comment_wrapper(&$variables) {
  $variables['reply_link'] = '';
  if (advanced_forum_is_styled($variables['node'], FALSE, 'comment-wrapper')) {
    advanced_forum_add_template_suggestions("advanced_forum_comment_wrapper", $variables);

    $form_on_seperate_page = variable_get('comment_form_location_' . $variables['node']->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE;

    $comments_locked = $variables['node']->comment != COMMENT_NODE_OPEN;

    if ($form_on_seperate_page || $comments_locked) {
      // If the post is locked or the comment form is on a seperate page,
      // build the reply/locked link / button.
      $variables['reply_link'] = theme('advanced_forum_reply_link', array('node' => $variables['node']));
    }
  }
}

becomes

function advanced_forum_preprocess_comment_wrapper(&$variables) {
  $variables['reply_link'] = '';
  if (advanced_forum_is_styled($variables['node'], FALSE, 'comment-wrapper')) {
    advanced_forum_add_template_suggestions("advanced_forum_comment_wrapper", $variables);

    $form_on_seperate_page = variable_get('comment_form_location_' . $variables['node']->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE;

    $comments_locked = $variables['node']->comment != COMMENT_NODE_OPEN;

    if ($form_on_seperate_page || $comments_locked) {
      // If the post is locked or the comment form is on a seperate page,
      // build the reply/locked link / button.
      $variables['reply_link'] = theme('advanced_forum_reply_link', array('node' => $variables['node']));
    }
  }
 // Pager.
  if (isset($variables['node']->comment_count)) {
    pager_default_initialize($variables['node']->comment_count, variable_get('comment_default_per_page_' . $variables['node']->type, 50));
  }
  $variables['pager'] = theme('pager');
}

In styles/naked/advanced-forum.naked.comment-wrapper.tpl.php
orig

<div id="forum-comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print render($content['comments']); ?>
  </div>

becomes

<div id="forum-comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print render($content['comments']); ?>
 <?php if (!empty($pager)): ?>
     <?php print $pager; ?>  
   <?php endif; ?>  
</div>