Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-13 05:05:41

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Comments without auto appends

Ok, I’m lost. I’ve been searching (for quite some time) the faq, the dev weblog (by the way, I said last week elsewhere the official site has nav and usability issue… it’s no issue, it’s a damn total impossible-to-find-anything state), and Textbook and I still can’t find the answer.

How am I supposed to call the comments if “auto append” is set to “no” ? What is the form called ?

The FAQ states:

If you’ve turned off “Automatically append comments to articles”, append this code (or something like it) to your article form as a starting point.

Without telling what “this code” is.

I always thought (and there’s a way of reading the FAQ like this) that “Automatically append comments to articles” means you have to use the comments tags in the article form by yourself, but then if I do that at the preview stage the comments_display form is automatically called and inserted (before my article, as TXP loves to do) even if it’s empty (and TXP doesn’t like that, replacing the null value with all kind of strange things).

Offline

#2 2006-01-13 05:11:31

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Comments without auto appends

for some reason I always turn off “Automatically append comments to articles” – this is what I have in my article form for the individual article view:

<code>
<h3><txp:comments_invite showalways=“1” textonly=“1” /></h3>
<txp:comments />
<txp:if_comments_preview>
<div id=“cpreview”>
<txp:comments_preview form=“comments” />
<txp:comments_form preview=“1” />
</div>
<txp:else />
<txp:comments_form />
</txp:if_comments_preview>
</code>

Offline

#3 2006-01-13 05:34:24

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Comments without auto appends

It should probably read “that code” rather than “this” – it refers to the code block above it:

<txp:comments />
<txp:if_comments_allowed>
<txp:comments_form />
</txp:if_comments_allowed>

“Automatically append comments” means that you don’t have to manually include tags to display the comments and comment input form – Textpattern does all that for you, just like it did in older versions. Turn that setting off, and it’s up to you to use the appropriate code for displaying comments. (The latter would have been the preferred method – giving the designer control over where and how comments are displayed – but we had to keep the old behaviour for backwards compatibility)

by the way, I said last week elsewhere the official site has nav and usability issue… it’s no issue, it’s a damn total impossible-to-find-anything state

Can you elaborate? The FAQ has a search function, categorized index, and lists related articles. What more should we do?

Last edited by zem (2006-01-13 05:39:36)


Alex

Offline

#4 2006-01-13 05:54:52

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Comments without auto appends

The thing is, why is comments_display called when the option is turned off then ?

I use this code :

<code>
<txp:if_comments_allowed> <div class=“corps”> <div id=“commentaires”> <h2>Commentaires des visiteurs</h2>
<txp:else /> <txp:if_comments> <div class=“corps”> <div id=“commentaires”> <h2>Commentaires des visiteurs</h2> </txp:if_comments>
</txp:if_comments_allowed> <txp:comments />
<txp:if_comments_preview> <div id=“cpreview”><p class=“comment-preview-averto”>Voici la pré-visualisation de votre commentaire. Merci de vous relire, et si tout va bien de valider votre commentaire.</p> <txp:comments_form preview=“1” /> </div> <!— /div#cpreview —>
<txp:else /> <txp:if_comments_allowed> <txp:comments_form /> </txp:if_comments_allowed>
</txp:if_comments_preview>
<txp:if_comments_allowed> </div> <!— /div#commentaires —> </div> <!— /div.corps —>
<txp:else /> <txp:if_comments> </div> <!— /div#commentaires —> </div> <!— /div.corps —> </txp:if_comments>
</txp:if_comments_allowed></code>

And the article’s form “comments_display” is called as the start of my article (with its content, or with an empy anchor and an error message about comments_display not existing if the form is empty).

@Zem, on the official site. Yep, I should have specified the weblog. It contain hard infos iirc, and it has no search function, no cats/tags usable, no summaries of content (list of articles). It’s been a couple of time I’ve search for something, not knowing where it is exactly, and the only way to search the weblog is to know the exact wording used, use a page-search browser tool and parse each older/nexer page of the log.

Offline

#5 2006-01-13 10:28:23

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Comments without auto appends

where is the txp:comments_preview tag? don’t you need that in there to output the previewed comment?

I haven’t played with comments very much, and this tag doesn’t appear in the default forms in the Txb – so can’t remember how I ended up with it … scuse me if I’m just muddying the waters

Offline

#6 2006-01-13 13:09:45

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

Re: Comments without auto appends

Best place to start diagnosing template problems, is to turn on debug-mode and look at the tag-trace at the bottom in the html-comment.

Also see: http://textpattern.com/faq/165/diagnosing-template-problems

It would help, if you could link to a page where the problem is occuring and debug is turned on.

Offline

#7 2006-01-13 20:59:41

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Comments without auto appends

Debug is activated, you can test it here

Here’s the trace at the comment preview stage :

<code>
< !— Runtime: 0,1528 —>
< !— Query time: 0,005265 —>
< !— Queries: 29 —>
< !— Memory: 3083Kb, <txp:comments_preview bc=“1” id=“36” /> —>
< !— txp tag trace:
[SQL (0,004173): select name from txp_txp_lang where lang=‘fr-fr’ limit 1]
[SQL (0,031381): select name, data from txp_txp_lang where lang=‘fr-fr’ AND ( event=‘public’ OR event=‘common’)]
[SQL (0,057675): select name, code from txp_txp_plugin where status=‘1’]
[SQL (0,000191): select ID,Section from txp_textpattern where url_title like ‘mon-tableau-a-moi-que-jai’ AND Section=‘tableaux’ limit 1]
[SQL (0,000125): select * from txp_txp_section where name = ‘tableaux’ limit 1]
[SQL (0,000099): select Posted, AuthorID, Keywords from txp_textpattern where ID=36]
[SQL (0,000581): select ID, Title, url_title, unix_timestamp(Posted) as uposted from txp_textpattern where Posted > ’2006-01-05 15:17:00’ and Section = ‘tableaux’ and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0,011146): select ID, Title, url_title, unix_timestamp(Posted) as uposted from txp_textpattern where Posted < ’2006-01-05 15:17:00’ and Section = ‘tableaux’ and Status=4 and Posted < now() order by Posted desc limit 1]
[SQL (0,000188): select RealName from `txp_txp_users` where `name` = ‘Jérémie’ limit 1]
[SQL (0,000446): select host from txp_txp_log where ip=‘81.57.160.51’ limit 1]
[SQL (0,000479): insert into txp_txp_log set `time`=now(),page=’/art/tableaux/mon-tableau-a-moi-que-jai’,ip=‘81.57.160.51’,host=‘cou93-1-81-57-160-51.fbx.proxad.net’,refer=’‘,status=‘200’,method=‘POST’]
[SQL (0,000097): select user_html from txp_txp_page where name=‘section’]
[Page: section]
<txp:output_form form=“Inc Header” /> [SQL (0,000100): select form from `txp_txp_form` where `name` = ‘Inc Header’ limit 1] <txp:ob1_title separator=” – “ order=”%sitename,%section,%article” /> [SQL (0,000121): select title from txp_txp_section where name = ‘tableaux’ limit 1] [SQL (0,000092): select title from txp_textpattern where id = ‘36’ limit 1] <txp:css/> <txp:if_section name=“tableaux”> [<txp:if_section name=“tableaux”>: true] </txp:if_section>
<txp:output_form form=“Inc Entete” /> [SQL (0,000094): select form from `txp_txp_form` where `name` = ‘Inc Entete’ limit 1] <txp:link_to_home> <txp:sitename/> </txp:link_to_home> <txp:ako_nav
name=“Accueil,Nos tableaux,À propos de nous,Le site” url=”/,/tableaux,/a-propos-de-nous,/le-site”
divid=“navigation-sections” headon=“0” />
<txp:if_individual_article> [<txp:if_individual_article>: true] <txp:article form=“Article solo” sortby=“title=” limit=“9999” /> [SQL (0,000274): select *, unix_timestamp(Posted) as uPosted from txp_textpattern where ID=‘36’ and Status in (4,5) limit 1] [article 36] [SQL (0,000095): select Form from `txp_txp_form` where `name` = ‘Article solo’ limit 1] [Module: Article solo] <txp:comments_preview bc=“1” id=“36” /> <txp:permlink> <txp:title/> </txp:permlink> <txp:body/> <txp:breadcrumb wraptag=”“ sep=” > “ link=“y” title=“y” /> [SQL (0,000098): select title from txp_txp_section where name=‘tableaux’] [SQL (0,000091): select lft as l, rgt as r from txp_txp_category where name=’‘ and type = ‘article’] <txp:permlink> <txp:title/> </txp:permlink> <txp:if_comments_allowed> [<txp:if_comments_allowed>: true] </txp:if_comments_allowed> <txp:comments/> [SQL (0,000171): select Form from `txp_txp_form` where `name` = ‘comments’ limit 1] [Module: comments] [SQL (0,000136): select *, unix_timestamp(posted) as time from txp_txp_discuss where parentid=‘36’ and visible=1 order by posted asc] <txp:comment_name/> <txp:comment_time/> <txp:message/> <txp:comment_name/> <txp:comment_time/> <txp:message/> <txp:comment_name/> <txp:comment_time/> <txp:message/> <txp:if_comments_preview> [<txp:if_comments_preview>: true] <txp:comments_form preview=“1” /> [SQL (0,000295): insert into txp_txp_discuss_nonce set issue_time=now(), nonce=‘bafcd029d84e52cea8ded361635f7f50’, secret=‘3aaf5168e184f98c71fe752f10516844’] [SQL (0,000150): select Form from `txp_txp_form` where `name` = ‘comment_form’ limit 1] <txp:comments_error/> </txp:if_comments_preview> <txp:if_comments_allowed> [<txp:if_comments_allowed>: true] </txp:if_comments_allowed> <txp:upm_article_image limit=“1” />
</txp:if_individual_article>
<txp:if_article_list> [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:output_form form=“Inc Pied de page” /> [SQL (0,000105): select form from `txp_txp_form` where `name` = ‘Inc Pied de page’ limit 1] <txp:output_form form=“Recherche” /> [SQL (0,000093): select form from `txp_txp_form` where `name` = ‘Recherche’ limit 1]
[ —- secondpass —- ]
<txp:comments_preview bc=“1” id=“36” /> [SQL (0,000256): select *, unix_timestamp(Posted) as uPosted from txp_textpattern where ID=‘36’ and Status >= 4] [article 36] [SQL (0,000091): select Form from `txp_txp_form` where `name` = ‘comments_display’ limit 1] —></code>

Last edited by Jeremie (2006-01-13 21:00:27)

Offline

#8 2006-01-13 21:29:23

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

Re: Comments without auto appends

The tag-trace shows, why the comments_display form is called during preview, it’s just as nardo suspected (it has to do with the backwards-compatible default behaviour, when you do not use txp:comments_preview).

Now things are a bit tricky, I agree, but there was no way we could have done it any differently without breaking backwards-compatibility in the 4.0.x line, which for obvious reasons is a nono, especially for a very elementary feature like comments.

The change from hard-coded to freely customizable comments happened in two steps:

Step 1 was a patch submitted to us: It removed some hardcoded stuff, but left other things hardcoded. Here we got the option of turning off auto-append (which was there to not break existing sites) to freely place comments. However Previews were still hardcoded, and they use(d) the form “comments_display”.

Step 2 finally allowed for freely placing previews, again without breaking all the sites out there. So, we check whether you are manually placing the preview, in which case we don’t add anything automatically. And if you are not placing the preview manually, well, then we use the old behaviour of using comments_display and automatically place the preview.

Here is an article that explains how to take control of previews:
http://textpattern.com/weblog/127/customizing-previews-for-commenting-in-the-upcoming-402

You simply have to add to your form/template:

<txp:comments_preview /> in the place where you want your preview to be.

Offline

#9 2006-01-13 23:07:31

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Comments without auto appends

I read about that, I remember it even when I was writing. But I thought it was the other preview function that was tested. Textbook is a little silent on this.

Thanks for the link, and for the explanations Sencer :)
I didn’t found it when I searched the website yesterday, and last week.

(Zem, that’s what I was talking about. It’s a good example of hard datas, that aren’t included in Textbook or the faq, and very hard to fiond even when you read the TXP websites and the forums everyday like I do… imagine other users, like newcomers… ).

Offline

Board footer

Powered by FluxBB