Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-08 07:26:00

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Comment form Question

I have problems figuring out how to shop up the code so that my html structure works and the comment form works.

What would be the general procedure here?
I tried pasting bits and pieces in all the comment forms, but I can’t get the structure to work properly although the rest of the layout looks fine.

Any help very much appreciated!
Thank you!
Dada

<code>
<!— comment area begin —> <div class=“comment-container”> <ul> <li><a href=“http://example.com” title=“example.com”>Donald Swain</a></li> <li>Jul 22, 03:11 PM</li> </ul> <p>I enjoy your site very much.</p> <!— comment input form start —> <fieldset> <p>* Required fields. Your e-mail address will not be published on this site</p> <p><label>Name*</label><input type=“text” name=“name” value=”“ size=“25” class=“comment_name_input” tabindex=“2” /></p> <p><label>Mail*</label><input type=“text” name=“email” value=”“ size=“25” class=“comment_email_input” tabindex=“3” /></p> <p><label>Website</label><input type=“text” name=“web” value=”“ size=“25” class=“comment_web_input” tabindex=“4” /></p> <label>Comments</label><p><textarea class=“txpCommentInputMessage” name=“message” cols=“25” rows=“5” tabindex=“1”></textarea></p> <input type=“submit” name=“preview” value=“preview” class=“button” /> </fieldset> <input type=“hidden” name=“parentid” value=“1” /> <input type=“hidden” name=“backpage” value=”/article/1/first-post” /> <!— comment input form end —> </div> <!— comment area end —> </div>
</code>

Offline

#2 2005-12-08 10:29:36

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

Re: Comment form Question

That’s because you are mixing up the forms. The comments themselves are controlled by the comments form template, the comment entry form is controlled by the comment_form form template. You need to keep them separate. TXP will automatically put comments inside an “li” tag and all the comments are contained within an “ol” tag. There is no need to put those tags into your templates. Simply format the comment itself.

The overall display of the comments and comment entry form on your page is controlled by the comments_display form template. This form is automatically called by TXP when you go into “individual_article” view ie when you click on the comment invite or the article title. The comments_display form template calls the individual forms mentioned above.


Stuart

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

Offline

#3 2005-12-08 14:44:39

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Re: Comment form Question

Thanks Stuart, but what I don’t understand is how the comment form is called or referred to from the archive page. Isn’t there a tag that I need to place in the archive page that refers to a comment form so that it can be displayed? Otherwise how would the page “know” where exactly in the html to display the comment form and the comments?

Thank you for your advice!
Dada

Offline

#4 2005-12-08 15:18:17

Nichod
Member
Registered: 2005-06-06
Posts: 119

Re: Comment form Question

Sorry to intrude on this thread. But it brought up an interesting question. Is there a way of turning off the comment form being called up for individual_articles? Is it just a matter of not placing it in the individual article?

Offline

#5 2005-12-08 15:51:59

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Re: Comment form Question

Sorry for being so difficult, but I have the following question:
I have the following code in my default archive page but have a hard time understanding how I would have to chop up the code so it displays correctly? The problem I am having is that the pieces that belong in the “comments” form AND the pieces for
“comment_form” are both inside the “comment-container” div. Please reply with a more detailed explanation, since I am a newbie! Thank you!

<code>
<!— comment area begin —> <div class=“comment-container”> <ul> <li><a href=“http://example.com” title=“example.com”>Donald Swain</a></li> <li>Jul 22, 03:11 PM</li> </ul> <p>I enjoy your site very much.</p> <!— comment input form start —> <fieldset> <p>* Required fields. Your e-mail address will not be published on this site</p> <p><label>Name*</label><input type=“text” name=“name” value=”“ size=“25” class=“comment_name_input” tabindex=“2” /></p> <p><label>Mail*</label><input type=“text” name=“email” value=”“ size=“25” class=“comment_email_input” tabindex=“3” /></p> <p><label>Website</label><input type=“text” name=“web” value=”“ size=“25” class=“comment_web_input” tabindex=“4” /></p> <label>Comments</label><p><textarea class=“txpCommentInputMessage” name=“message” cols=“25” rows=“5” tabindex=“1”></textarea></p> <input type=“submit” name=“preview” value=“preview” class=“button” /> </fieldset> <input type=“hidden” name=“parentid” value=“1” /> <input type=“hidden” name=“backpage” value=”/article/1/first-post” /> <!— comment input form end —> </div> <!— comment area end —> </div>
</code>

Last edited by dada78 (2005-12-08 15:52:36)

Offline

#6 2005-12-08 17:59:32

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

Re: Comment form Question

For the time being just forget you ever heard of HTML and let’s get some basics sorted out first. You are confusing the issue. There are 3 forms to concetrate on – comment, comments_form and comments_display. Let’s sort those out first then you can look at HTML. Your comment form template should be similar to this:-

<code>
<txp:comment_name /> replied:<br />
<txp:message /><br />
<txp:comment_time /> <txp:comment_permlink>#</txp:comment_permlink></code>
<br />

Your comment_form form template, assuming you don’t want tables, should look something like this:-

<code>
<h3 id=“postcomment”>Leave A Reply</h3>
<p><label for=“name”><txp:text item=“name” /></label><br /><txp:comment_name_input /></p>
<p><label for=“email”><txp:text item=“email” /></label><br /><txp:comment_email_input /></p>
<p><label for=“web”>website</label><br /><txp:comment_web_input /></p>
<p><txp:comment_remember /></p>
<p><txp:comments_help /></p>
<p><txp:comment_message_input /></p>
<p><txp:comment_preview /> <txp:comment_submit /></p></code>
<br />

Your comments_display form template should be like this:-

<code>
<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></code>
<br />

Get your forms to that point so that they at least work then we can look at your HTML requirements.

The call to the comments and comments_form forms is done via the comments_display form. This form is automatically called when you have a comments_invite tag in your article form, you have “Auto append comments” switched on in “Preferences” and Txp goes into “individual_article” view. It is all automated. All you have to do is format how you want things to look.


Stuart

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

Offline

#7 2005-12-08 18:52:00

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Re: Comment form Question

Thanks a bunch Stuart!

Okay, I got the comment form working but it looks horrible and my layout is messed up ;-(

Looking at the code I pasted before, what bits and pieces would I need to put where? This will give me a better idea of how textpattern works.

Thank you so much in advance!
Dada

Last edited by dada78 (2005-12-08 18:52:27)

Offline

#8 2005-12-08 21:27:29

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

Re: Comment form Question

OK. Now your main container is <code><div class=“comment-container”></code> so go to the comments_display form template and wrap the whole thing with it.

TXP automatically puts all the comments within an “ol” and each individual comment within an “li” so there’s no need to bother with those except that your CSS may refer to a “ul” instead. You need to change that in your CSS. You can’t change TXP. It also gives it a class so where you have “ul” change it to “ol.comments”. Then let me know how it looks.


Stuart

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

Offline

#9 2005-12-08 22:56:40

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Re: Comment form Question

Stuart-you are the king! It’s looking great!

Essential to me was this line in your post:“The call to the comments and comments_form forms is done via the comments_display form” and that I should wrap everything with the comment_container div!
That definitely opened my eyes! I just couldn’t understand how I would have to chop up my code to accommodate these 3 comment forms…Now it makes sense.

So basically I have the basic html structure in the pages (default and archive) and then cut/paste the areas that would contain tags into the appropriate forms.

Finally I reference the forms with the specific tags in my page templates so the information generated by these tags will be displayed in the areas I have defined in the html structure.

I still have one problem though:
Where do I define the layout/html structure for the preview comment view? It looks all messed up?

Thanks a bunch!

Offline

#10 2005-12-08 23:17:27

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

Re: Comment form Question

Aha. Now comes the complicated bit. Have a look at that comments_display form template then have a look at this version:-

<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 extra block of code at the top controls how things look in “preview” mode. You will still need your wrapping div of course. Now the new top block is calling a different form – “comments_preview” – to view the comment. Here’s one I made earlier:-

<code>
<div id=“cpreview”>
<p class=“preview”>This is how your comment will appear when submitted.</p>
<ol class=“comments”><li>
Add your existing “comments” form code here
</li></ol>
</div></code>
<br />

Basically what you need to do here is take the top block of code down to and including the “li” tag, then add your existing “comments” form code, then add the last bit of the above code from the closing “li” onwards, to the bottom of the new form. You will need to add “p.preview” to your CSS to style it and you can change the text to whatever you want.


Stuart

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

Offline

#11 2005-12-09 00:49:30

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Re: Comment form Question

Great, works like a charm!

But I encountered a strange formatting fauxpas and can’t figure out where it might be coming originating from.
Problem: On the archive page, there is an extra paragraph tag (see code below) and I looked in every form and every page but can’t find it??? Any thoughts where this might be coming from? I really appreciate your help and hope that I can give back to the community once I know what I am doing.

<code>
<p><input type=“hidden” name=“parentid” value=“1” /></p><p><input type=“hidden” name=“backpage” value=”/article/1/first-post” /></p></form>
</code>

Last edited by dada78 (2005-12-09 00:51:39)

Offline

#12 2005-12-09 11:46:59

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

Re: Comment form Question

That’s a hidden value that TXP uses. It’s not something you put in. You won’t find it in any of the forms. I think it is something to do with connecting the comment to the article.


Stuart

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

Offline

Board footer

Powered by FluxBB