We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extension: Goto Latest Comment *Supports Paginated Comments*

Development and Programming

MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

Greetings,

This will automatically scroll the page down to the last comment after it has been posted. It also supports pagination of comments.

Installation Instructions 1. Download the extension and place it in it’s correct spot. 2. Enable the extension 3. Put {last_comment} inside your {exp:comment:entries} tagpair towards the top. Just under the opening tag would be the best spot. This variable will be replaced with the anchor tag so wherever you put this variable will be where the anchor tag will be. 4. Enjoy 😊

Versions v1.5 - I’ve changed the name of the class to Goto_latest_comment to make more sense which means you’ll have to delete the ext.goto_last_comment file out of your extensions folder. This new version will remove any hooks out of your extensions table that aren’t being used anymore.

Best Regards, cody

       
Sean C. Smith's avatar
Sean C. Smith
3,818 posts
16 years ago
Sean C. Smith's avatar Sean C. Smith

Very nice will use this shortly.

       
Matthew Pennell's avatar
Matthew Pennell
221 posts
16 years ago
Matthew Pennell's avatar Matthew Pennell

koff Scroll to new comment extension koff

😉

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

hmm…well it looks like it’s just two different ways to do the same thing 😊.

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

Updated extension and am now hosting it on GitHub. Please check original post.

       
Jules van Schaijik's avatar
Jules van Schaijik
209 posts
16 years ago
Jules van Schaijik's avatar Jules van Schaijik

Thanks for posting this extension. I would love to use this extension, but so far no luck. Here is the error message I am getting:

Notice: Undefined index: comment_id in … extensions/ext.goto_last_comment.php on line 143

Any idea what is going wrong? Jules

P.S I am using Weever, in case that makes a difference.

       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

Hi,

Goto Last Comment has the same bug, as Scroll to last comment extension.

I described that bug here.

       
Matthew Pennell's avatar
Matthew Pennell
221 posts
16 years ago
Matthew Pennell's avatar Matthew Pennell

Hi Laisvunas - I can’t replicate the bug you described in the comments on my site; whenever I submit a second comment immediately after a first one, the redirect works as expected.

       
netfreaks's avatar
netfreaks
7 posts
16 years ago
netfreaks's avatar netfreaks

The same bug appears with paginated comments page…

I mean several times :D

Is there any workaround with that?

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios
Hi, Goto Last Comment has the same bug, as Scroll to last comment extension. I described that bug here.

Umm…no, I never had this problem.

Anyways, the first post has been updated with the latest version which supports pagination now. I’ve also removed hook and used a javascript to change the return URL so I could support pagination.

       
Dylan Smith/Context Design's avatar
Dylan Smith/Context Design
346 posts
16 years ago
Dylan Smith/Context Design's avatar Dylan Smith/Context Design

I’ve run into a couple of headscratchers regrading this extension. One I’ve managed to clear up, but other’s still got me confused.

First, it seems there’s a conflict of sorts with LG .htaccess Generator, which adds a trailing slash to urls that don’t end with a file extension.

This ends up combining w/ Goto Latest Comment to create urls like:

http://www.mysite.com/local/comments/greatstory//P15/#latest_comment

which doesn’t lead anywhere, of course.

A quick addition to .htaccess (after the LG rule that adds the slash) fixes this:

# Remove double slashes // to fix Goto Latest Comment/LG .htaccess Generator conflict
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

So that’s solved.

Make sure, if you’re using this fix, to make it in the LG .htaccess Generator settings, not just in your file, or it’ll be overwritten soon enough.

The one I can’t figure out is how the #latestcomment anchor is supposed to get added. I get urls that are looking for that anchor, but it’s not in my code to be found. So, while a commentor ends up on the correct page, which is nice, there’s no scrolling to the comment.

Any ideas what I’m doing wrong here?

thx!

Edit: A quick look at Win IE7 and I’m seeing urls that don’t include the anchor at all. Pagination works, but certainly not scrolling.

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

I’m very sorry you were having all these problems!! :(.

Regarding LG .htaccess Generator, your right, I didn’t take into account for that. I’ll look into it some more and try to make a fix for that.

As for your second point, totally my fault!! I forgot to add the instructions to the forum when I moved this extension from GitHub to this thread. Please read them above. You’ve got to add a special EE Variable inside your comments block.

Again, so sorry :(.

       
Dylan Smith/Context Design's avatar
Dylan Smith/Context Design
346 posts
16 years ago
Dylan Smith/Context Design's avatar Dylan Smith/Context Design
I’m very sorry you were having all these problems!! :(. Regarding LG .htaccess Generator, your right, I didn’t take into account for that. I’ll look into it some more and try to make a fix for that. As for your second point, totally my fault!! I forgot to add the instructions to the forum when I moved this extension from GitHub to this thread. Please read them above. You’ve got to add a special EE Variable inside your comments block. Again, so sorry :(.

No problem at all!

This is a really great extension, and works like a charm now that I’ve got that variable in there ; )

I’ve got a neat little system going here now - a combo of your Goto Latest Comment, the quote/reply system from DigitalNoon that I hacked to play nicely w/ Rockatee’s Live Comment Preview and html_buttons. I created a new comments_html_buttons function, so I can play around with adding in image and video features.

Rounding things off is LG Quarantine.

I’m thinking about trying to incorporate the Encouraged Commentary response links - can you tell I got into this comment system I’m building?

Thanks to you, MeanStudios, and everyone else who comes up with such great code!

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

Wow, what a concatenation of comment mods :D. No worries dude, I’m glad at least one person found this useful heh.

Let me know when you’ve got a finished product 😊.

       
Dylan Smith/Context Design's avatar
Dylan Smith/Context Design
346 posts
15 years ago
Dylan Smith/Context Design's avatar Dylan Smith/Context Design

A bit of a tweak I made to this extension:

We’re showing the latest 3 comments at the bottom of an entry page, with a comment form. When someone submits, we wanted them to go to the latest comment on the comments pages, which we’re showing in a different template.

Mark Bowen’s Comment Redirect conflicts with this extension, so that option doesn’t work.

So, in ext.goto_latest_comment.php, around line 131, I added this to change the return url:

$ret_url = str_replace("report", "comments", $ret_url);

report is the template that shows the entry, comments would be - logically enough - the template that shows all of the comments - adjust to your template structure and season to taste.

Don’t know if it’d matter if it were before or after

$ret_url = preg_replace("#/P\d+#i", '', $ret_url);

I put it before.

Hope that helps somebody out there….

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.