MT: Easy comment and entry editing
MovableType 01/20/2003 |Responding to Dave Winer expounding upon the virtues of Manilla (the CMS Dave creates), Morbus offers this tip for MovableType users:
The “Edit This Page” button may not be a default item in the Movable Type templates, but it is certainly possible — I’ve been using it on the individual archives of Gamegrene.com for quite a long time (it’s there, but is an invisible pixel gif at the bottom of the page). Add the following to your templates and, assuming you’re cookied into the MT adminterface, you’ve got your “Edit This Page” equivalent (broken across multiple lines for ease of reading):
<a href="/cgi-bin/mt/mt.cgi?__mode=view&_type=entry& blog_id=1&id=<$MTEntryID$>">Edit This Page with Movable Type</a>
<
p>I use a similar technique here, only one that allows me to not have to worry about the blog ID number, and I have ‘edit’ links both for each individual entry, and for any comments that are left on my site. As a bonus, the edit links are hidden, so unless you’re me (or you read this post), you’ll never know that they’re there! I use a combination of HTML, JavaScript, CSS, and MT tags in the “Posted by…” link on every post and comment to allow me to jump directly into editing mode if I need (either due to a typo or revision on my part, or to clean up or delete any unneccessary comments left by visitors), yet keep it hidden from casual prying eyes.
First off, the code for the “edit post” links as it resides in my MT templates (all one line in the template, broken here for readability):
Post<a href="<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&
id=<$MTEntryID$>&blog_id=<$MTBlogID$>" target="_blank" onmouseover="window.status=''; return true;" class="hidelink">ed</a> by <$MTEntryAuthor$>
By using the <$MTBlogID$> MT tag rather than just typing in “blog_id=X”, we avoid any problems with having the wrong blog ID chosen if you’ve moved the code from one template to another, or don’t know the ID number of the blog you’re working with.
The onmouseover="window.status=''; return true;" bit of JavaScript ensures that the status bar of the browser does not change when someone mouses over the link — one of the visual clues to the existence of a hyperlink. Note that there are actually two single quotation marks with nothing between them after the window.status= declaration — if you type them as double-quotes, you’ll break the code by closing out the onmouseover function too early. The ‘return true;’ declaration is just there to ensure that the link will get passed to the browser correctly when clicked on.
The last special bit to the tag is the class="hidelink" declaration. This is calling on a class I have set up in my CSS stylesheet that looks like this:
a.hidelink:link, a.hidelink:visited, a.hidelink:hover, a.hidelink:active {
text-decoration: none;
color: #7f7f4d;
cursor: text;
}
This set of CSS rules ensures that any HTML anchor with the class ‘hidelink’ will have no text decoration (under- or over-lining or anything else), will be the same color as the surrounding text, and the cursor will not change to the standard ‘pointy’ cursor as it moves over the link. Between this CSS and the JavaScript code in the link, the end result is a working, active link that is entirely hidden from most browsers (and even if someone does find the link, they’ll still need to know your MT login and password to be able to make any changes).
The same trick can be used on comments, to jump you directly to the comment editing screen. Here’s the code I used in the “Posted by…” line for comments on this site (again, as one line in the template):
On <a name="<$MTCommentID pad="1">"><$MTCommentDate$></a>, <$MTCommentAuthorLink spam_protect="1"$> post<a href="<$MTCGIPath$>mt.cgi?__mode=view&_type=comment&
id=<$MTCommentID$>&blog_id=<$MTBlogID$>" target="_blank" onmouseover="window.status=''; return true;" class="hidelink">ed</a>:
[See also: Font tweaks and hiding links | Our friend, the humble ‘title’ attribute | Erk - how did I manage this one? | Destinations | iChat just went bye-bye ]
3 Responses to “MT: Easy comment and entry editing”
Leave a Reply






May 11th, 2003 at 11:28 am
Thanks for the great code snippets. Apparently, Winer didn’t notice this since he just posted another little boast about Manila.
What would be really nice is a little pop-up with just that text and a save button that closes the window upon successful rebuild. Maybe I’ll put that together…wouldn’t be hard.
July 6th, 2003 at 9:32 am
MT: Easy comment and entry editing
The Long Letter > MT: Easy comment and entry editing” href=”http://www.djwudi.com/longletter/archives/2003/01/20/mt_easy_comment_and_entry_editing.php”>djwudi.com > The Long Letter > MT: Easy comment and entry editing Edit this “entry” in Movable Type…
November 10th, 2003 at 10:31 pm
TypePad User Group :: Switching from blog view to blog edit with one mouse click
TypePad User Group :: View topic - switching from blog view to blog edit with one mouse click Richard had been asking for this for a while and he got his wish. In this thread you will also find information