ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

comment:entries and weblog:entries pagination in same template

June 03, 2010 12:45pm

Subscribe [1]
  • #1 / Jun 03, 2010 12:45pm

    airways

    154 posts

    Edit: Realized this isn’t even really a Weever problem - the real problem is that mod.comments.php uses the same parameter as mod.weblog.php does to do pagination. The client I’m working on this for has a paginated sidebar next to the current entry listing other entries for the currently selected category, and paginated comments for each entry.

    I’m not sure how many people use Weever around here but it seems like a pretty good module with a few flaws. I’ve had quite a bit of trouble getting it to do what I want… latest problem is this:

    I am having a lot of trouble getting Weever to work with pagination on a template that also uses weblog:entries pagination. It seems that mod.comment.php tries to use the P* value instead of the CP* value that Weever provides. It only does this if $dynamic is on, but with it off Weever doesn’t work at all, so I can’t just turn it off.

    The comment pages are sliced correctly by Weever, but then whatever offset is in P* is also used to skip the first few entries of the current page.

    So if I have /P2/CP3 in the URL, Weever slices the comments to page 3 of comments, but then the mod.comment.php code chops off the first two comments. Any ideas how to fix this? I don’t really want to do another hack, I’ve never had to resort to core hacks prior to this project. 😕

    I guess my real issue is that I do not get why this code (in mod.comment.php) makes any sense:

    if ( ! $dynamic)
            {
                if (preg_match("#N(\d+)#", $qstring, $match) OR preg_match("#/N(\d+)#", $qstring, $match))
                {
                    $current_page = $match['1'];    
                    $uristr  = $FNS->remove_double_slashes(str_replace($match['0'], '', $uristr));
                }
                
            }
            else
            {        
                if (preg_match("#/P(\d+)#", $qstring, $match))
                {
                    $current_page = $match['1'];    
                    
                    $uristr  = $FNS->remove_double_slashes(str_replace($match['0'], '', $uristr));
                    $qstring = $FNS->remove_double_slashes(str_replace($match['0'], '', $qstring));
                }
            }

    Both of these are dynamic. How is P* more “dynamic” than N*? There should be a way to turn off this detection or change the tokens that it looks for in the URL.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases