Quicktags for Comments

quicktags_comments.png

Many people wanted to know how I implemented these guicktags into my comments form. So here's a quick tutorial for that. In your comments form find

<p><label for="text">Comments:</label> <MTIfAllowCommentHTML>
(you may use HTML tags for style)</MTIfAllowCommentHTML><br/>
<textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea></p>

and replace it with

<p><label for="text">Comments:</label> <MTIfAllowCommentHTML>
(you may use HTML tags for style)</MTIfAllowCommentHTML><br/>
<textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea></p>
<div class="quicktags"><p><label for="text">Comments:</label> <MTIfAllowCommentHTML><script src="http://www.movalog.com/mt/js_quicktags.js" type="text/javascript"></script><script type="text/javascript">edToolbar();</script></MTIfAllowCommentHTML><br style="clear: both;" /><textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea><script type="text/javascript">var edCanvas = document.getElementById('text');</script></p></div>

and change the path in red to point to your js_quicktags.js file (which can be downloaded from the Quicktags tutorial linked above). After this is done, you'll want to make sure that the HTML generated by these buttons are allowed by your sanitize settings.

These quicktags can be applied to any textarea. To do so, first call the Quicktags toolbar with this

<p><label for="text">Comments:</label> <MTIfAllowCommentHTML>
(you may use HTML tags for style)</MTIfAllowCommentHTML><br/>
<textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea></p>
<div class="quicktags"><p><label for="text">Comments:</label> <MTIfAllowCommentHTML><script src="http://www.movalog.com/mt/js_quicktags.js" type="text/javascript"></script><script type="text/javascript">edToolbar();</script></MTIfAllowCommentHTML><br style="clear: both;" /><textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea><script type="text/javascript">var edCanvas = document.getElementById('text');</script></p></div>
<script src="http://www.movalog.com/mt/js_quicktags.js" type="text/javascript"></script><script type="text/javascript">edToolbar();</script>

and then apply them to the textarea by putting this line of code straight after the textarea

<p><label for="text">Comments:</label> <MTIfAllowCommentHTML>
(you may use HTML tags for style)</MTIfAllowCommentHTML><br/>
<textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea></p>
<div class="quicktags"><p><label for="text">Comments:</label> <MTIfAllowCommentHTML><script src="http://www.movalog.com/mt/js_quicktags.js" type="text/javascript"></script><script type="text/javascript">edToolbar();</script></MTIfAllowCommentHTML><br style="clear: both;" /><textarea tabindex="4" id="text" name="text" rows="10" cols="50"></textarea><script type="text/javascript">var edCanvas = document.getElementById('text');</script></p></div>
<script src="http://www.movalog.com/mt/js_quicktags.js" type="text/javascript"></script><script type="text/javascript">edToolbar();</script>
<script type="text/javascript">var edCanvas = document.getElementById('text');</script>

where "text" is the id of the textarea.

20 Comments

quack said:
on Jan 21, 2005 9:45 PM | Reply

I implemented quicktags into my own comments form a few weeks ago, using your previous tutorial as a starting point. It makes it so much easier for people to know what HTML tags they can and can't use (without having to specify in a description).

puneetworld said:
on Jan 22, 2005 5:55 PM | Reply

Hey arvind thanks I was looking forwards towards implementing this one…. Earlier… tried but didn’t work…. Then had left the thought of implementing it.. as didn’t had any time to get it working was having the error .. but thanks to the Spoon feeding.. It worked and … I learned also where I was going wrong when Ii had tried to implement in comment

hey also Nice New layout :-) cool

Beth said:
on Jan 23, 2005 8:00 PM | Reply

Thank you! :):)

Donna said:
on Feb 15, 2005 12:51 PM | Reply

Do you have a way to add these in the main MT entry area? I know IE people can see something like these but I'm an Opera user and we don't get to see formatting buttons.

Would be great to have these shortcuts when posting.

Thanks, Donna

dave said:
on Feb 22, 2005 11:40 PM | Reply

Alright...when I link to the movalog script, it works fine. but when I link to the script on my own server, it does not work. Any ideas?

dave said:
on Feb 23, 2005 1:15 AM | Reply

Sorry...I should have been a little clearer. When I attempt to run teh script from my server, none of the buttons show up.

When I point my browser at the script, I get an error. My error log reads as follows: Premature end of script headers.

Any advice?

t3ase said:
on Mar 14, 2005 5:52 AM | Reply

Testing S quicktag on this site to see what it's supposed to be.

t3ase said:
on Mar 14, 2005 5:53 AM | Reply

And, forgot the tag. Sorry.

t3ase said:
on Mar 14, 2005 5:54 AM | Reply

Question, what is the S after underline used for?

jummy said:
on Apr 28, 2005 12:12 AM | Reply

Hi Arvind,

I do not know where in my comments form (is that the Main Index template?) that I am supposed to insert the text.

I am running MT 3.16.

Many thanks!

Dafydd ab Hugh said:
on Oct 4, 2005 12:45 PM | Reply

Huh... I followed these instructions exactly. My Preferred Archive Type is Individual; I'm using MT 3.2; I uploaded the js_quicktags.js file to public_html, so I thought its URL would be biglizards.net/js_quicktags.js . Am I mistaken?

I replaced the stuff in the first box above (inside the Individual Archive template) with the stuff in the second box; then I changed www.movalog.com/mt/js_quicktags.js to biglizards.net/js_quicktags.js.

I made sure that .quicktags was defined in my stylesheet.

Then I rebuilt the blog, all the files. But when I went to my blog and clicked on comments, the comment form looked exacly as it looked before I did anything... no quicktag links, nothing.

What am I doing wrong? I thought I followed all the instructions to a T.

Dafydd

Dafydd ab Hugh said:
on Oct 6, 2005 4:18 PM | Reply

Arvind, the code we're supposed to drop into the template just looks weird (I substituted regular parentheses for angle bracket, so I could post it here):

++++++++++++++
div class="quicktags")(p)(label for="text")Comments:(/label) (MTIfAllowCommentHTML)(/p)

(script src="http://www.movalog.com/mt/js_quicktags.js" type="text/javascript")(/script)(script type="text/javascript")edToolbar();(/script)

(p)(/MTIfAllowCommentHTML)(br style="clear: both;" /)
(textarea tabindex="4" id="text" name="text" rows="10" cols="50")(/textarea)(script type="text/javascript")var edCanvas = document.getElementById('text');(/script)(/p)(/div)

++++++++++++++

In the first line above, you open a (p) paragraph; then you open and close (label); then you open (MTIfAllowCommentHTML) -- and then you close the (p), leaving (MTIfAllowCommentHTML) still open!

Then you open and close a couple of scripts.

Finally, you open a (p) paragraph -- and the very next thing you do is close the old (MTIfAllowCommentHTML) tag.

I don't understand this at all.  I didn't know you could overlap block tags like that; in fact, I thought you couldn't!  Is this correct?

Dafydd 

Arvind Satyanarayan said:
on Oct 6, 2005 4:46 PM | Reply

Hi Daydd, the code's been corrected. The code beautifier plugin was doing some weird stuff! Thanks for the heads up.

Dafydd ab Hugh said:
on Oct 7, 2005 8:21 AM | Reply

Huh, it's still not doing anything.  I did the replacement with the new script thingie into my Individual Archive Template; I saved, then rebuilt the site.

But still, when I went to my blog and clicked "comments" on one of the posts, I was taken to a comment box that looked exactly the same as before.

I'm sure my permalink is the Individual Archive; it says that in my Settings, and also, when I go to the Date-based and Category Archive Templates, they have no commenting sections; and where they link to the comments, the href contains the variable MTEntryPermalink archive_type="Individual".

So I'm totally befuddled.  What could I be doing wrong?

Dafydd 

Derek Movin said:
on Oct 11, 2005 1:20 AM | Reply

Gift Baskets by Unique Gift Baskets offers snack and gourmet baskets, corporate gifts, new baby, birthday baskets, Gift Baskets for men, women www.gift-basket.2itb.com/Gift-Basket.htm

Unique Gift Baskets

Zed said:
on Oct 15, 2005 4:14 AM | Reply

I tried both methods you described to implement quicktags but neither works with MT 3.2

(Checked with IE and FF; IE tells me that an object is expected..)

dasadas said:
on Nov 29, 2007 8:06 PM | Reply

asdas da a dsas as das das

hgfhgf said:
on Apr 21, 2008 2:13 AM | Reply

If you want to be the most powerful in game, you should have the enough Wow gold then you can buy the best weapons, equipment, etc. But Farming wow Gold is very boring and waste a lot of time.

Jas Spas said:
on May 5, 2008 5:32 AM | Reply

Don't suppose anyone fancies installing this for me?

Jas Spas said:
on May 5, 2008 5:33 AM | Reply

Don't suppose anyone fancies installing this for me?

Leave a comment

Preview