« How (little) women think? | Main | Sleeping Parrot »

August 06, 2003

Hacking the comments

I am sure some other typepad user is going to want to know how I fiddled the comments and the trackbacks. If I am really lucky, someone will tell me a better way to do it :-) (and how to get smilies working).

First, make sure you have your template EXACTLY how you like it (because changing things afterwards is hard). Save your template with some memorable name (I will call mine BOB).

Next do the convert operation on your templates (only available to PRO users but you need to be a PRO user to edit the html anyway). Select 'Edit Template Sets' and find your template, it should be called something like 'BOB [Advanced]'. Click on the edit link.

Choose the 'Main Index Template' and scroll down until you find the line that looks like:

| <a href="<$MTEntryPermalink$>#trackback">TrackBack (<$MTEntryTrackbackCount$>)</a>

We are going to replace every line AFTER this one and BEFORE the line that reads:

</MTEntries>

Make sure you keep the two lines I just referred to in the template but delete everything between them (mainly blank lines and paragraph markers and the end of the MTPing tags).
Now cut and paste the following code (sorry for the lack of indentation):

<blockquote>
<div style="background-color: #FFCC33; font-size: x-small; border-top:
1 px solid #993333; border-right: 1px solid #993333; border-left:
1px solid #993333; border-bottom: 1px solid #993333;">
<MTPings lastn="5">
"<$MTPingBlogName$>" linked with
<a href="<$MTPingURL$>"><$MTPingTitle$>
<br /></a>
</MTPings>
</div>
</blockquote>
</MTEntryIfAllowPings>
</p>
<MTEntryIfAllowComments>
<MTComments>
<blockquote>
<div style="background-color: #FFCC33; font-size: x-small; border-top:
1px solid #993333; border-right: 1px solid #993333; border-left:
1px solid #993333; border-bottom: 1px solid #993333;">
<$MTCommentBody apply_macros="1" $>
Posted by: <$MTCommentAuthorLink spam_protect="1"
show_email="0"$> on <$MTCommentDate$>
</div>
</blockquote>
</MTComments>
</MTEntryIfAllowComments>

You will want to fix the colours (all those #FFCC33 and #993333 bits) unless you happen to be using a desert theme like I am. In this case the #FFCC33 is the background (yellow sort of colour) and the #993333 is the border (red-brown). Given that the two <div style> tags are the same, I tried to fiddle the css template but I don't know enough (anything) about css so I gave up. If you do decide to change the main colour scheme later, I suggest you keep these lines somewhere, delete the advanced template, make the changes to the standard template and start again from the top of this article.

Oh yes, to actually see this working you will need to go to your blog configuration and select the 'BOB [Advanced]' template set (otherwise it will look like nothing changed).

Please feel free to improve my code or tell me how to do it properly with the stylesheets!

P.S. If you want the comments all in one box, instead of a box for each comment (like the trackback entries), then move the div tags outside the blockquotes.

P.P.S. I can't work out how to code the 'if (MTComments > 0)' that I used to use because that works for php but not in html. Maybe a Javascript sort of thingy.....

Posted by Ozguru at August 6, 2003 12:08 PM


Comments


I like the new look!

Posted by: rr at August 6, 2003 12:08 PM

Small thing - can we get a space a the beginning of the comments so the first letter dosn't disappear?

Posted by: Peskie at August 6, 2003 12:08 PM