Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-10-24 16:04:00

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

if_comments_preview

I’m using the if_preview tag within the comments_display form to either show a little “preview” message above the previewed comment or the “title” I usually have at the top of a comments list. I’ve noticed that when viewing a preview I get the preview message without the title as I want but if I scroll down the page to where the existing comments are, it is repeating the process there as well, that is I’m seeing the preview message without the title above the comments list. Is this expected? Are you doing anything about it or are we stuck with it? It’s nothing critical methinks but might be considered undesirable.


Stuart

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

Offline

#2 2005-10-25 08:15:49

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

Re: if_comments_preview

I’m sorry, not sure if I understand what is happening.

  • modified comments_display. Ok, which tags did you add? Can you post the form?
  • Are you seeing the preview multiple times? That shouldn’t be, unless you call the tag yourself multiple times. Can you post a tag-trace or link to a tag-trace?

btw: If you update, you’ll find the tags are now named if_comments_preview and comments_preview.

Last edited by Sencer (2005-10-25 08:17:00)

Offline

#3 2005-10-25 14:07:02

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

Re: if_comments_preview

Oh right then. I’ll update it first and come back in a bit.


Stuart

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

Offline

#4 2005-10-25 14:44:52

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

Re: if_comments_preview

Updated to r1058 and changed the tags accordingly. Same problem exists. Here’s a screenshot. You can see the preview at the top showing the added message. This replaces my normal “h3 title” that appears at the top of a comments list. If you scroll down to the existing comments you can see the same thing happening there as well. I haven’t created a separate form for this. “Auto append” is “on”. This is my comment_display form:-

<code><txp:if_comments_preview>
<p class=“preview”>This is how your comment will appear when submitted.</p>
<txp:else />
<txp:if_comments>
<h3 id=“comment”><txp:comments_count /> Comments for <txp:title /></h3>
</txp:if_comments>
</txp:if_comments_preview>
<txp:comments />
<txp:if_comments_allowed>
<txp:comments_form />
</txp:if_comments_allowed></code>
<br />

I can’t spot anything obviously wrong with that.


Stuart

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

Offline

#5 2005-10-25 15:06:58

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

Re: if_comments_preview

Aaah, you misunderstood the semantics of if_comments_preview. It evaluates to true, when the “page-request” is a preview. So everywhere on the page it will always evaluate to either true or
false. This has to be that way, or otherwise we would be severely limiting how far you can customize comments and previews.

(There is some serious black magic going on, with how preview used to work, and how we preserved that behaviour for bc. Ask, if you want to hear the gory details…)

If you want a message to appear only above the article-title at the top of your article, you can put the following at top of your article form.
<code>
<txp:if_comments_preview>
<p class=“preview”>This is how your comment will appear when submitted.</p>
</txp:if_comments_preview>
</code>

And if you use the same article-form for custom-article tags in lists on the same page alongside your comments, you may want throw another if_individual_article conditional around that.

Offline

#6 2005-10-25 15:45:18

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

Re: if_comments_preview

OK. I think I’ve got it now. I’ve created a new comments form called comments_preview and modified my comments_display form thus:-

<code><txp:if_comments_preview>
<txp:comments_preview form=“comments_preview” />
<txp:comments_form preview=“1” />
<txp:else />
<txp:if_comments>
<h3 id=“comment”><txp:comments_count /> Comments for <txp:title /></h3>
</txp:if_comments>
<txp:comments />
<txp:if_comments_allowed>
<txp:comments_form />
</txp:if_comments_allowed>
</txp:if_comments_preview></code>
<br />

That seems to have it. In fact it’s an improvement on how it used to be as everything now appears in the “correct” order – article, preview, commment entry form – which didn’t happen before. Very nice. :)


Stuart

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

Offline

Board footer

Powered by FluxBB