For example now you can truly have a 2-column layout with the article on one side and the comments, comments-form and comments-preview on the other side. Up to now, the preview would always appear hardcoded in front of the article. Of course everything is backwards-compatible, so if you leave your templates as they are the preview will still be where it used to be.
Here is a code example
<txp:if_comments_preview> <div id="cpreview" style="background-color:#ff0"> <b>Hello, the following is only a preview. Please re-read your comment for clarity and hit submit once you approve of it.</b> <txp:comments_preview form="my_preview" /> <txp:comments_form /> </div> </txp:if_comments_preview>
You can see that we enclosed it in the new preview-conditionals.
- First we add an anchor
id="cpreview"so that the browser can scroll to the correcct spot on the page during preview. We also highlight the enclosing
divwith a yellow background to inform users that here is something to pay attention to.
- Then there’s a textual message to inform the user this is only a preview.
<txp:comments_preview />is called which renders the comment with a form called my_preview (which looks just like a regular display form for comments like the built-in comments which is used by default).
- Next is the
<txp:comments_form />is called.
The key element in all this is the
<txp:comments_preview /> tag. If that is encountered anywhere on the page, the old behaviour of prepending comments is automatically turned off. This also means you can use the conditional independant of customized previews, for example to simply show a message at the top of your page.
Sidenote: While we are talking about comments, the comments_invite tag has also seen a bit of a renovation. It has three new attributes, which you can see here:
<comments_invite showcount="0" textonly="1" showalways="1" />
showcount will show or hide the number of comments next to the invite.
textonly will return the invite text as just text, without a link. And finally if
showalways is set to
1, the invite will also display on individual article pages (which it doesn’t by default, for historical reasons).