Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2005-10-01 17:32:51
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
ajw_if_preview
Conditional output for comment preview. For use from within the forms comments_display and/or comments_form. Pretty simple, really :-)
Usage:
<txp:ajw_if_preview>
<h3 id="post-comment">Comment Preview</h3>
<txp:else />
<h3 id="post-comment">Post your comment</h3>
</txp:ajw_if_preview>
Download: ajw_if_preview
Last edited by Andrew (2007-01-03 03:57:48)
Offline
Re: ajw_if_preview
Thanks a lot, I’ll have to give this a try soon. Hopefully this means no more hacking the actual TXP code.
Offline
#3 2005-10-02 07:27:46
- Anark
- Member
- Registered: 2004-08-14
- Posts: 101
Re: ajw_if_preview
Cool.
I’d like to put “Comment Preview”, marked up in an H1 tag, right atop the Preview page, above the comment previewed. Using your plugin, I can get that if I put the heading in the comments_display form, but then the heading gets repeated further down the page, ahead of the existing comments. Is there any way around that?
Offline
#4 2005-10-02 08:14:57
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: ajw_if_preview
Ok, bug squashed. New version: v0.2
Last edited by Andrew (2005-10-02 08:15:17)
Offline
#5 2005-10-02 10:26:35
- Anark
- Member
- Registered: 2004-08-14
- Posts: 101
Re: ajw_if_preview
Thanks!
Offline
Re: ajw_if_preview
Very helpful, and you’re right, this should be incorporated in 4.0.X.
TextPattern user since 04/04/04
Offline
#7 2005-10-02 16:41:42
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: ajw_if_preview
Nice one Andrew, this was one of my pet peeves. I did find a bug/quirk, though, the else part wouldn’t work. :)
Offline
#8 2005-10-02 17:28:07
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: ajw_if_preview
Ok, thanks for the lead. I think I’ve finally fixed it. We’re now at v0.3 and for reference, here’s how I’m currently using this plugin within my comment forms:
comments
<!-- not used -->
comments_display
<txp:ajw_if_preview>
<h3 id="comment-preview">Comment preview</h3>
<txp:else />
<h3 id="comments">Comments</h3>
</txp:ajw_if_preview>
<txp:comments />
<txp:if_comments_allowed>
<txp:comments_form />
</txp:if_comments_allowed>
<txp:if_comments_disallowed>
<p>Comments are closed for this article</p>
</txp:if_comments_disallowed>
comment_form
<div id="comment-form">
<txp:ajw_if_preview>
<txp:else />
<h3 id="post-comment">Post your comment</h3>
<p><a href="#content-main">Jump back to top</a> ↑</p>
</txp:ajw_if_preview>
<!-- other comment form stuff -->
</div>
Hope that helps!
Last edited by Andrew (2005-10-02 17:34:55)
Offline
#9 2005-10-02 20:08:58
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: ajw_if_preview
Great! Works just dandy.
Offline
#10 2005-11-01 18:05:07
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: ajw_if_preview
The functionality of this plugin is now available by default with the release of v4.0.2 with the tags txp:comments_preview
and txp:if_comments_preview
.
Offline
Pages: 1