How To: link directly to recent comment entries from a weblog
Posted: 30 November 2007 05:07 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  77
Joined  11-18-2007

I’m a EE-newbie an needed to figure out how to link to a recent comment entry (single entry w/anchor) from my default weblog index-site.
I searched throught the forum, wiki etc. and couldn’t really find a solution. Until I stumbled upon this entry in the comments user guide. It took a while for me, so I wanna share for anybody my solution especially if you’re a newbie.

here is now the code I use on my website and it works quite well:

From the weblog index:

<ul class="modulebox_content">
   
{exp:comment:entries orderby="date" sort="desc" limit="5" weblog="{my_weblog}" dynamic="off" disable="pagination|custom_fields|categories|member_data|trackbacks"}
         
<li class="liste">{name} zu - <a href="{title_permalink="{my_template_group}/comments/"}#{comment_id}">{title}</a></li>
   
{/exp:comment:entries}    
</ul>

From the comments page (same weblog):

{exp:comment:entries weblog="{my_weblog}" limit="25"}
<div class="commentbox_content">
   <
h1><a href="{permalink="{my_template_group}/comments"}">{count}</a></h1>
   
{comment}
</div>
{/exp:comment:entries}

The variable {count} counts the entries only on the comments page. The permalink adds the anchor id to each comment. so you can jump straight to it from any weblog.
If someone has any suggestions, let me know.

Stefan

Profile
 
 
Posted: 30 November 2007 07:39 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  210
Joined  02-18-2007

Hey there,

You need to utilise the comment ID variable. E.g.

<div id="comment-{comment_id}">
{comment}
</div>

Would produce

<div id="comment-401">
This is comment ID 401.</div>

Hope this helps
bobby

 Signature 

KMRL Mojo Radio Live!
My Blog
Running 1.6.1 Build 20071114

“I know more than you do, for you think you know something, and I know I know nothing.” - Socrates


Must-Have Addons:

Accessible Captcha
Akismet for EE

Profile
 
 
Posted: 01 December 2007 06:16 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  77
Joined  11-18-2007

Hi Bobby McGee,

thank you for your reply. Yeah, you’re right. I have forgotten to set an ID for this entry.

<h1><a href="{permalink="{my_template_group}/comments"}" id="{comment_id}">{count}</a></h1>

But funnny is, that it works both ways. Because EE puts it self an #ID at the end of the URL if you use {permalink=”“}:

http://your_website.com/index.php/main/comments/your_article/#7

Cheers
Stefan

Profile
 
 
Posted: 01 December 2007 01:51 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  210
Joined  02-18-2007

Glad to help
-bobby

 Signature 

KMRL Mojo Radio Live!
My Blog
Running 1.6.1 Build 20071114

“I know more than you do, for you think you know something, and I know I know nothing.” - Socrates


Must-Have Addons:

Accessible Captcha
Akismet for EE

Profile
 
 
Posted: 01 December 2007 01:55 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  210
Joined  02-18-2007

Oh, and also remember that the ID or name attribute cannot start with a number - so for shorthand you could just use c{comment_id}. That is, if you care about web standards, it won’t validate.

 Signature 

KMRL Mojo Radio Live!
My Blog
Running 1.6.1 Build 20071114

“I know more than you do, for you think you know something, and I know I know nothing.” - Socrates


Must-Have Addons:

Accessible Captcha
Akismet for EE

Profile
 
 
Posted: 01 December 2007 06:35 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  77
Joined  11-18-2007

Oh, yes. You’re right! i use now: comment-{comment_id}

Cheers

Profile
 
 
Posted: 07 March 2008 05:06 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  219
Joined  05-11-2004

very useful discussion - but i have some problem with it: i have pagination when there are more than 100 comments per page. how would i solve this? with the method described above i get a link to e.g.

http://www.lehrerfreund.de/...entryname/#comment-2059


but i needed

http://www.lehrerfreund.de/...entryname/P100/#comment-2059

has anybody an idea how to solve this (perhaps with any conditional on the index-page?)?

thanks in advance

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 15 April 2008 06:21 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  4
Joined  02-05-2002

I’m also trying to figure this one out…how do you link from a different page (for instance, the home page) to a particular comment on a story when that story’s comments have been paginated.

Profile
 
 
Posted: 15 April 2008 08:50 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  210
Joined  02-18-2007

Hi,

There is also a variable called “permalink” for exp:comment:entries. Try that. I have not used it myself.

-bobby

 Signature 

KMRL Mojo Radio Live!
My Blog
Running 1.6.1 Build 20071114

“I know more than you do, for you think you know something, and I know I know nothing.” - Socrates


Must-Have Addons:

Accessible Captcha
Akismet for EE

Profile
 
 
Posted: 16 April 2008 02:41 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  219
Joined  05-11-2004

inbetween i solved it this way:

in the right bar (permanently on every page) this code:

{exp:comment:entries sort="desc" orderby="date" limit="10" dynamic="off"}
<p><b>{name}</b>, {comment_date format="%d.%m."}<br />
to '<a href="{title_permalink="group/template"}#c-{comment_id}">{title}</a>'.</p>
{/exp:comment:entries}


output: “John, 23.04. to <a href=”#”>Title of Entry</a>

on the single-entry-pages i use something like this:

{exp:comment:entries sort="asc" orderby="date" dynamic="ON" cache="yes" refresh="10" limit="100" paginate="both"}
<div class="kommentarautor" id="c-{comment_id}">(#{absolute_count}) {url_as_author}&nbsp; wrote on {comment_date format="%d.%m.%Y"}:</div>
<p>{comment}</p></div>
{paginate}
{if
"{total_pages}" != 1}<div align="center"><div class="marker"><strong><p>Page {current_page} of {total_pages} --- Jump to: {pagination_links}</strong></p></div></div>{/if}
{
/paginate}
{
/exp:comment:entries}


limit=“100” - how much comments you want until the page breaks
div class=“kommentarautor” id=“c-{comment_id}” (#{absolute_count}) - this is the comment-id you link to with the above quoted ”{title_permalink=“group/template”}#c-{comment_id}”

good luck implementing it grin

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 17 May 2008 03:34 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  219
Joined  05-11-2004

So the problem is back:

i am really sure the way i pointed out above worked. now i checked my site and the pagination-issue doesn’t work anymore. i didn’t change the code. what i changed:

1. i upgraded to 1.6.3
2. i added the weblog=“weblogname”-parameter to the exp:comment:entries-tag.

so again i have exactly this problem i was talking some posts above in post #6

is there any hint or remedy?

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 20 May 2008 09:07 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  219
Joined  05-11-2004

just wanted to ask if anybody perhaps has a solution for this ...

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
   
 
 
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 10:33 AM
Total Registered Members: 62602 Total Logged-in Users: 30
Total Topics: 77077 Total Anonymous Users: 20
Total Replies: 416291 Total Guests: 197
Total Posts: 493368    
Members ( View Memberlist )
Newest Members:  gabewellsGlaucoeudj1nsehartEasyMLance SloanandrewjhscottShuvopatricovghazalravi