Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-09 14:29:20

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

whatfor you use comment_anchor?

What is this tag: <txp:comment_anchor /> supposed to do? I can not figure out how it shall work. (I read TextBook)

Offline

#2 2006-04-09 14:45:27

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: whatfor you use comment_anchor?

return '<a id="c'.$thiscomment['discussid'].'"></a>';

which will output sth. like:

<a id="c000644"></a>
The goal is to allow anchors in urls which will scroll the page to where that anchor (and thus the comment) is.

Last edited by Sencer (2006-04-09 14:46:52)

Offline

#3 2006-04-09 16:37:33

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: whatfor you use comment_anchor?

On TextBook it says <txp:comment_anchor /> should be placed in the form commentns_display. Eric did that here (see at the very bottom) but no anchor shows up in source code.
??

Offline

#4 2006-04-09 18:01:55

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: whatfor you use comment_anchor?

It is working for me, I just tested it. See here. I would need to see a tag-trace for troubleshooting.

edit: Not comments_display. It belongs in the form that is used to display a comment (same one where <txp:message />, <txp:comment_name />, <txp:comment_time /> etc. go). I don’t see how this would make any sense in comments_display, as the anchors are for individual comments, and thus you couldn’t place in any sensible place in comments_display.

Last edited by Sencer (2006-04-09 18:04:26)

Offline

#5 2006-04-09 18:37:25

valmeria
Member
From: France
Registered: 2005-10-22
Posts: 46

Re: whatfor you use comment_anchor?

OK, I putted it on the “comments” form which is now like that :

<code><txp:comment_anchor /><txp:message /><small>Par <txp:comment_name /> <txp:comment_time />&nbsp;<txp:comment_permlink>Permalink</txp:comment_permlink></small><br><br>
</code>

And I do have an anchor ID per post in the source of this page

Now, I still don’t understand why the <txp:comments_invite showalways=“1” /> tag which I putted on top page do not send to any anchor but one named “commenter” which is coming from I don’t have any idea :(

On my idea, the <txp:comments_invite showalways=“1” /> tag created a link to direct go to the “comment” form on the page, am I wrong ????

Thanks for inputs.

Eric

Offline

#6 2006-04-09 18:57:04

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: whatfor you use comment_anchor?

I changed the phrase in Textbook to read:

Used in the form that renders your comments, the default form is named “comments”.

Hopefully this conveys the meaning more clearly.

Offline

#7 2006-04-09 19:34:58

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: whatfor you use comment_anchor?

So, what is the difference between <txp:comment_anchor /> and <txp:comment_permlink></txp:comment_permlink>?
what are the possible different uses for each one?

thanks.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2006-04-09 20:11:03

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: whatfor you use comment_anchor?

Err, this is basic (X)HTML, nothing textpattern specific.

1) http://www.w3.org/TR/REC-html40/struct/links.html#h-12.1

2) http://www.w3.org/TR/xhtml1/#C_8

Link 1) explains links, anchors and fragment identifiers in HTML, and Link 2 explains how it changed with respect to XHTML (which is how textpattern deals with it).

The permlink-tag outputs a permalink with an uri pointing to the fragment (comment) on the page and [by default] also includes the fragment identifier itself in the form of an id-attribute. If you wish to “pull” that apart, and place the fragment identifier somewhere else than where the permalink is, then you can use the comment_anchor-tag.
Simplest example: You want the permlink at the bottom of the comment, but you wish to have the fragment identifier at the beginning, so when somebody follows the permlink they will see the beginning of the comment, rather than the end of it.

Now, I still don’t understand why the tag which I putted on top page do not send to any anchor but one named “commenter” which is coming from I don’t have any idea

You have to assign some element on the page the correct fragment identifier. The link at the top which ends in #commenter points to a fragment with the id commenter – looking at the source you haven’t assigned that id to anything on the page. Go into your comments_display form and above <txp:comments /> put something like: <p id="commenter">Look at all these comments...</p>. And then that’s where your link from the top will be pointing. Alternatively you can use an empty a-tag if you don’t want to have any text. Or you can use the comments_invite-tag as well.

Offline

#9 2006-04-09 20:18:25

valmeria
Member
From: France
Registered: 2005-10-22
Posts: 46

Re: whatfor you use comment_anchor?

So thanks Sencer ! I misunderstood what tag was doing and just correct my template after reading your post, and it works ;)

Thanks also to Alexandra, I learned some TXP good tips today ;)

Offline

#10 2006-04-09 20:39:14

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: whatfor you use comment_anchor?

Thanks Sencer for that explanation.
It open new possibilities for my comments layout form.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#11 2006-04-09 20:46:35

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: whatfor you use comment_anchor?

I think that the anchor is also used when a visitor submits a new comment so that the new page displays his/her comment at the top of the screen followed by the thank you message rather than going right to the top of the page. This means the visitor can see that his/her comment has been accepted straight away rather than having to scroll back down the page to check.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#12 2006-04-10 15:51:17

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: whatfor you use comment_anchor?

I have always wanted TXP to work like wordpress regarding this comment’s ID stuff. In WP it is handeled verry smoothly with the ID being assigned to the list item of the comments list, so when you would go to comment permalink you would always go to the beginning of the comment, regardless of the position of the anchor in the comments holder (parent element, li, whatever).

To illustrate, follow this link: http://herbiv.org/recepti/ravioli-sa-fetom#c000096

Offline

Board footer

Powered by FluxBB