There probably are a magnitude of techniques on how to customize and personalize comment previews. In ExpressionEngine, by default, the comment preview's functions are stored in a separate template.
For my design, I've decided to reduce the amount of templates used. For this very blog, I am using a single template to retrieve data. I have done away with the single article template (comments template by default), the categories template, the tags template (I use solspace's magnificient tag module) and will most likely use this single template for the search and archives as well.
As this design is very young and not completely done - you may have taken notice of the absence of a search feature and the lack of an archive - I have set out to complete the site by end of the week and iron out the few remaining bugs (such as incompatibility with IE6, oh the love of my life) and other quirks and hiccups that are currently present.
But anyway, onto the comment live preview. Being immensely taken by and favourable of Jason Santamaria's live comment preview, I decided that this is something I wanted, needed too. As I am using jQuery - And a sweet tool it is indeed - I went on a hunt on how to possibly accomplish this task with very few lines of code using jQuery. And, alas, I found a great resource that would help me in writing my tiny weeny little function for the live commenting feature.
Firstly, the code:
// Live Comment Preview jQuery function$(function() {$('#comment').one('focus',function() {});var $comment = '';$('#comment').keyup(function() {$comment = $(this).val();$comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br ><br />').replace(/(<\/?)script/g,"$1noscript");$('p.live-preview').html($comment);});});
As you can see, I have adapted the code provided by Karl Swedberg, hence all credits go to him. I have merely tweaked the function to suit my needs.
Secondly, you will need to create the according markup for it, depending on where you'd like to have your live preview displayed. Here, I have simply used a floated div element and assigned it the class .comment-preview. In this div tag, I tell jQuery to add a paragraph with the class of .live-preview.
I have placed the code inside the template that renders my single articles just below the comment form, so it would look something like this:
<div class="comment-preview"><h3>My Comment Preview</h3><p class="live-preview">placeholder text</p></div>




organizedfellow writes on Sun Aug 3, 2008
This will come is very userful Rockatee!
Thanks for the work around!