Comment pagination is back. Sidebar link should still work.

Posted by Les on Tuesday, April 17, 2007 at 11:55 PM. Read 698 times. Tags:
{name} pic

Elwed dropped me an email with a solution to the comment links in the sidebar when using paginated comments problem so I’m trying it out. This means that the comments pages are once again limited to 25 per page to help speed up page rendering on the bigger threads. The sidebar recent comment list should still link directly to the comment regardless of which page it’s on. I’ve also updated the All Comments links to take advantage of the same solution.

The solution takes advantage of the fact that EE doesn’t really care what comment you start pagination with so we just stick a query in that counts the number of comments in the thread up to the one we want to link to and then we build a link with the pagination set to that number and it starts with that one and any other comments that come after it.

It’s pretty clever actually and I feel kinda stupid for not thinking of it myself.

Big thanks to Elwed for being more clever than I am.

Comments:

Page 1 of 1 pages

elwedriddsche United States Posted on 04/18/2007 at 12:56 AM

elwedriddsche pic

I can’t take much credit for taking a hint from an unrelated post in the EE forums.

 Signature 

Science is answers that must always be questioned.
Philosophy is questions that may never be answered.
Religion is answers that must never be questioned.
Politics is answers that lobbyists pay for.

Webs United States Posted on 04/18/2007 at 02:21 AM

Webs pic

Funny how usually the simplest solution is the right one…

 Signature 

Brother Spikey Mace of Patience

Unitarian Jihad Name: Get Yours
Unitarian Jihad Background

elwedriddsche United States Posted on 04/18/2007 at 09:55 AM

elwedriddsche pic

Something I noticed: If you terminate the link with /#comments, the behavior differs for threads with less or more than one page’s worth of comments.

If you have more than one page of comments, the comment you’re asking for starts off the page and the page automatically scrolls to that comment. That’s just fine.

If there’s less than one page of comments, the browser windowis positioned at the first comment and not the one whose link you clicked on. I think you can fix this by doing something like

{if commentcount < 25}#c{comment_id}{else}P{commentcount}/#comments{/if}

 Signature 

Science is answers that must always be questioned.
Philosophy is questions that may never be answered.
Religion is answers that must never be questioned.
Politics is answers that lobbyists pay for.

Page 1 of 1 pages

Name:

Email:

Location:

URL:

Smileys


Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:


<< Back to main