Links to Individual Comments
Posted: 28 May 2008 12:10 PM   [ Ignore ]  
Summer Student
Total Posts:  18
Joined  04-13-2008

I’d like to able to individually link to each comment on my page as they’re posted.  I’ve searched the wiki but haven’t found the exact answer.

Essentially, when you post a comment, it would say:

Joe on 5/28 at 11:48 AM

I’d like the 11:48 AM link to provide a link directly to that comment.

Profile
 
 
Posted: 28 May 2008 12:23 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRank
Total Posts:  1994
Joined  05-07-2007

Pandagonian:

Check out:  http://expressionengine.com/docs/modules/comment/entries.html#var_comment_entry_id_auto_path

I think that should do it for you.

-greg

Edit:  fixed the link.

 Signature 
Profile
MSG
 
 
Posted: 28 May 2008 12:38 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  18
Joined  04-13-2008

Is there a way to make it jump to the comment in question?  Right now, it just loads at the top of the entry.

Profile
 
 
Posted: 28 May 2008 12:54 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRank
Total Posts:  1994
Joined  05-07-2007

I suppose that you could put the following tag on each one:

<a name="#{count}"></a>Joe on 5/28 at 11:48 AM said:

or this might help:

http://expressionengine.com/docs/modules/comment/entries.html#var_permalink

I hope that can get you down the right path.

-greg

 Signature 
Profile
MSG
 
 
Posted: 28 May 2008 01:07 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Greg A. is spot on, although I’d use {entry_id} for building the HTML anchor, since it is guaranteed not to change. So, I use something like:

<a name="#comment_{entry_id}">

Makes sense?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 07 August 2008 01:06 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  24
Joined  04-29-2008

I’ve been trying to do the same things, but you guys lost me.

On my index page I have:

<div class="sidetitle">Recent Comments</div>
You must be a registered member <i>and</i> logged-in to post comments.<br />
<
hr>
{exp:comment:entries sort="desc" weblog="{my_weblog}" orderby="date" limit="30" dynamic="off"}
On {comment_date format
="%m/%d/%y"} at {comment_date format='%h:%i %A'}:<br />
<
b>{name}</b> added comments to the thread: <a href="{comment_url_title_auto_path}">{title}</a>
<
hr>
{/exp:comment:entries}

I’d like the link for the title of the entry to go directly to the comment its referencing. I’m just not sure where either of you guys are saying to place

<a name="#comment_{entry_id}">

Does this go on the index page, or the comment page, or both.

Sorry for being dense.

Profile
 
 
Posted: 07 August 2008 01:11 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  24
Joined  04-29-2008

My comment page looks like this:

<ol>
{exp:comment:entries weblog="{my_weblog}" limit="25" paginate="both"}

<li>{comment}<br /><br />

{if signature}
<p>{signature}</p>
{/if}

<div class="posted">Comment by {author}  &nbsp;on&nbsp; {comment_date format='%m/%d'} &nbsp;at&nbsp; {comment_date format='%h:%i %A'}</div>

{paginate}
<div class="paginate">
<
span class="pagecount">Page {current_page} of {total_pages} pages</span>  {pagination_links}
</div>
{/paginate}

</li>

{/exp:comment:entries}
</ol>

Profile
 
 
Posted: 07 August 2008 02:19 PM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

I think Ingmar meant to say, {comment_id}.  So your main link to the comment will be something like:

<a href="{comment_auto_path}#{comment_id}">{title}</a>

And on the destination page, you put your “a name” tag:

<a name="#{comment_id}"></a>

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 07 August 2008 07:53 PM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  24
Joined  04-29-2008

Thanks grant. Although, I must still not be putting the

<a name="#{comment_id}"></a>

in the right place.

When I click the title of comment it doesn’t even take me to the correct entry…

I’m not the brightest bulb when it comes to this stuff… Can anyone give me a little more guidance here?

Profile
 
 
Posted: 07 August 2008 08:04 PM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRank
Total Posts:  1994
Joined  05-07-2007

You put it next to each comment, then you link to each comment by doing something like:

<a href="http://mydomain.com/index.php/comments/my_url_title#24">Link</a>

 

24 being the comment Id.

Read here for the skinny on link names/anchors.

Also, check out Veerle’s Blog on how she did comment anchors.

Hope that helps,

-greg

 Signature 
Profile
MSG
 
 
Posted: 07 August 2008 08:35 PM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  24
Joined  04-29-2008

Thanks! I’ll keep at it and let ya’ll know how I make out. I have a feeling I’ll be back with more questions though.

Profile
 
 
Posted: 07 August 2008 09:44 PM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRank
Total Posts:  1994
Joined  05-07-2007

We have all asked a ton of questions here.  Just pay it forward when you have the answer.  wink 

Good luck & make sure to let us know how it comes out!  smile

-greg

 Signature 
Profile
MSG
 
 
Posted: 03 September 2008 07:23 AM   [ Ignore ]   [ # 12 ]  
Summer Student
Total Posts:  24
Joined  04-29-2008

I got it working!

However whenever the comments paginate over more than one page, this doesn’t work. How do I get it to link to those comments? When the comments paginate over to another page, this is what loads:

http://domain.com/index.php/site/comments/entrytext/#17133

But what I need is:

http://domain.com/index.php/site/comments/entrytext/P25/#17133

or P50, P75, etc.

Any idea how to accomplish this?

Profile
 
 
Posted: 03 September 2008 01:04 PM   [ Ignore ]   [ # 13 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Not sure if that is an inherent EE functionality.  With that said, you may need to submit a feature request or come up with a cool extension.

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 03 September 2008 03:40 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  380
Joined  03-01-2006
Greg Aker - 28 May 2008 12:54 PM

<a name="#{count}"></a>Joe on 5/28 at 11:48 AM said:

You don’t need to use empty anchors with the name attribute. You can link internally to any element with an ID, so presumably your text will be wrapped in a paragraph or list item or something so it would be this instead:

<li id="#post_{count}">Joe on 5/28 at 11:48 AM said:</li>

and do away with the extra empty element. (Remember that IDs can’t start with numerals so you have to put some alphabetical characters in front of the ID#.)

 Signature 

John Faulds - Tyssen Design | Member of EE Pro Network

Profile
 
 
   
 
 
‹‹ RSS Feed - No Paragraph Breaks      IE6 Error ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64908 Total Logged-in Users: 41
Total Topics: 81852 Total Anonymous Users: 20
Total Replies: 440061 Total Guests: 220
Total Posts: 521913    
Members ( View Memberlist )