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
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.
Hi,
Goto Last Comment has the same bug, as Scroll to last comment extension.
I described that bug here.
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.
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.
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 :(.
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!
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….
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.