Changelog
This is where I will try to document all the changes made to the site. Sometimes I'll make lots of changes, sometimes i'll make little tweaks.
Conditional Comments
1076 days ago
I didn’t just want to have comments [2] or simmilar on my homepage, I wanted somethng a little more human.
So I set myself the task of using Textmate's conditional tags to allow me to do this.
Commenting can be switched on or off for every post so there's three possibilities
- comments off
- comments on, no comments yet
- comments on, comments made
this is the code that allows me to do it...
<p class="controls">
<txp:permlink>Permalink</txp:permlink> |
<txp:if_comments_allowed>
<txp:if_comments>
<txp:permlink> <txp:comments_count /> comments</txp:permlink>
<txp:else />
<txp:permlink>No comments yet</txp:permlink>
</txp:if_comments>
<txp:else />
Comments off
</txp:if_comments_allowed>
</p>
The key tags here are <txp:if_comments_allowed> and <txp:if_comments>
What that markup is saying is...
"here's a paragraph with a class of "controls" (The class doesn't do anything yet. I'll use that to style it with CSS later). First thing inside this paragraph is a permalink to the article followed by a bunch of conditional statements. If comments are allowed and there's comments display a link to the comments form saying the number of comments followed by "comments", else display a link saying "No comments yet", and if comments aren't allowed simply say "Comments Off".
Simple.
All content © Copyright