Play Nice
A word about the original writing found on this site

Unless otherwise noted, these are my words, ideas, thoughts and feelings. If you like them great, if you don't that's fine too.

You're welcome to quote my writing, but please make sure you include a link back to the page from which you got the material.

This work is licensed under a Creative Commons License.
Creative Commons License

Thanks,
Patricia

Page 1 of 1 pages

Comments off code

I don’t do it very often, but every once in a while I don’t allow comments. Until today I couldn’t figure out how to have the words ‘Comments off’ show up whenever I turned comments off. This of course has been bugging me because, well, I’m that sort of goofy.

I finally leafed through the MT manual* and discovered the MTEntryFlag. Using this and a little PHP (the same PHP snippet I keep using the hell out of) I finally figured out how to accomplish this.

Just in case anyone is interested:

The actual value returned by the MTEntryFlag is commented out so it won’t show on the blog.

<!—<$MTEntryFlag flag=“allow_comments”$>—>
<?
if (<$MTEntryFlag flag=“allow_comments”$> == 0) {
?>Comments off<? } ?>

This should go right before the MTComments code.

*Seriously, you’d think I’d be better about reading manuals and instructions. It really would save me a great deal of trouble.

Posted on Dec. 07, 2003[0]print
Last comment posted by code snippet

For my MT pals… I’ve noticed that some commenting systems show the last person who posts a comment on an entry and, because I’m the nerdy, jealous type, I wanted that on the blog, so I figured out how to do that in MT.

Here’s the code:

<MTEntryIfAllowComments>
<?
if (<$MTEntryCommentCount$> > 0) {
?>
<MTComments sort_order="ascend" lastn="1"><$MTCommentAuthorLink spam_protect="1"$></MTComments> had the last word | <? } ?><a href=”<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>” onclick=“OpenComments(this.href); return false”><$MTEntryCommentCount$> </a>
          </MTEntryIfAllowComments>

Since it uses a little bit of php code I’m not sure if it will work with .html pages. If you try it and it works let me know.

Also if you’re using any sort of comments plugin you’ll want to change the code for the (<$MTEntryCommentCount$> > 0) part. I use Adam Kalsey’s simplecomments plugin so my code is actually (<MTSimpleCommentCount> > 0).

Posted on Sep. 09, 2003[0]print
Customizing MT ind archives with PHP

All of you people that actually know PHP may want to skip this entry as what I’m about to say will probably make you cringe. You could probably do this in some frightfully easy way, but I’ve barely cracked my PHP book open, so this has to work for me for now.

I discovered the following PHP snippet when I implemented the show/hide script from ScriptyGoddess and I use the hell out of it throughout my site.

<?
if ( xxx == xxx ) {
?>

... info ...

<? } ?>

My latest bit of witchery allows me to have only certain information show up on a page. For example, the blog that publishes the static pages of the site (about, quotes, etc) and the writing in the writing section is set to individually archive entries.

The problem is that I only want a feedback form and the creative commons license info to show up for those entries tagged with the ‘writing’ category.  So, the above php snippet to the rescue.

I added the MT category code to the Individual Archive template, but commented it out because I don’t want it to show. Then I surrounded the feedback form and cc info with the following:

<?
if (

<$MTCategoryLabel$>

== writing) {
?>

... feedback form ...
... cc info ...

<? } ?>

So when the page gets published, the entry category is checked, and if it matches ‘writing’, the form and creative commons license info shows up.

By repeating the php snippet and changing the category type to be matched, you could have information show up for several different categories, I would imagine. Though I haven’t tried this out yet.

See for yourself:
entry not tagged as ‘writing’
entry tagged as ‘writing’ with feedback form and cc info

Posted on Sep. 09, 2003[0]print
The Magic Behind the Curtain
Posted on Aug. 10, 2003[0]print

Page 1 of 1 pages