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: Scroll to Comment

Development and Programming

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

I’ve just started working with ExpressionEngine (first site hopefully launching tomorrow), and one thing I found sorely missing was the ability to make a page scroll down to the newly submitted comment after a visitor has added it.

So I made an extension. And here it is. 😊

It’s pretty basic - stick the extension file in your /extensions folder and the language file in your /languages folder, and enable the new extension under Admin > Utilities > Extensions Manager.

The single setting allows you to specify a prefix for the comment_id to be used in the markup. (Under a Strict doctype, you can’t start a CSS id with a number, so you should really call them “comment123” or similar).

Any feedback, suggestions or comments, please let me know. 😊

Moved to Extensions forum by Moderator

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Fantastic work, thanks for this one. Going to try this out later.

Perhaps this thread should be re-titled and moved to the Extensions development forum though? 😉

Best wishes,

Mark

       
Matthew Pennell's avatar
Matthew Pennell
221 posts
16 years ago
Matthew Pennell's avatar Matthew Pennell
Perhaps this thread should be re-titled and moved to the Extensions development forum though? 😉

Details, details… 😉

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Moved per request. 😊

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

Hi,

I made a little fork of Scroll to Comment extension. The aim of this fork is to have a a possibility to form URLs without # symbol. That is, instead of forming URLs as this

http://mysite.com/index.php/blog/entry/#comment190

to form them as this

[quote]http://mysite.com/index.php/blog/entry/comment190/ 

Such possibility can be handy in some cases (e.g. when there are on the page elements having CSS “position” set to “fixed” or in cases when javascript onload makes some change of CSS rules, such as change of font). In these cases URLs having # symbol cannot scroll marked element into view correctly; only some custom javascript that parses URL can.

In settings I added a new option “Use symbol # in the last URL segment” (default is yes). And in ext.scroll_to_comment.php file I added all needed branching of code for the case “yes” and for the case “no”.

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

Hi,

I published Comment Location plugin which can be used together with Scroll to Comment extension in order to support pagination of comments.

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

Good stuff. 😊 Sorry for not replying to your emails about forking, I’ve been too snowed under with ‘proper’ work to worry about EE add-ons. 😉

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

Matthew,

This extension does not play nice with Weever. Might there be a simple solution to solve the conflict?

(If both are installed, weever no longer nests new comments. Old comments are not affected however; they are still displayed in the proper, nested order.)

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

The conflict seems to have something to with the fact that both extensions use the insert_comment_end hook. Weever has priority 10, scroll-to-comment priority 1.

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

I’ll take a look when I have time. Your last comment seems to indicate that either:

  • Weever isn’t checking whether previous extensions have modified the session, or
  • I’ve stopped all processing of further extensions after Scroll_to_comment runs

Looking at my code it may be that the latter is true. Try removing the $EXT->end_script = TRUE line from my extension.

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

Thanks Matthew. I really appreciate it.

I tried removing the $EXT->end_script = TRUE line, but that didn’t work.

In case it helps, Mr. Wilson, the author of Weever, sent me to this page in the docs for a clue as to what might be the problem: http://expressionengine.com/docs/development/extensions.html#hook

       

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.