Some useful new tags in ExpressionEngine 1.1

I’ve had a number of people write in asking me how I’ve done various things with my installation of ExpressionEngine so I thought I’d go ahead and make an entry where I reveal my secrets. If you’re not running an EE blog then chances are this won’t interest you, but if you are then read on.

First off, Rick and the crew have been most gracious about implementing several new variables for use in the Notification Emails that make life a lot easier. The first new addition isn’t actually new as it’s been available in a slightly different form for quite awhile, but was forgotten and never added to the manual and that’s the UNWRAP tags for turning off the automatic word-wrapping in the notification emails. This is useful for the rather lengthy URLs that EE can end up generating in comment notifications as without them EE will wrap the long URL and make it useless for clicking on. Modify your comment notification emails as follows to turn off word-wrapping on the URLS:

{unwrap}
{comment_url}
{/unwrap}

There’s a few other new tags available in the User Comment Notification template that can prove useful as well. Use the {name_of_commenter} variable to list who left the comment in question as opposed to having it just say that “Someone” left a comment. Then {name_of_recipient} can be used to list the name of whom the email is being sent to. And finally {comment_id} can be used to insert the ID number of the comment in question in the email. Now you’re probably wondering what that last item might be useful for. Well, if you’re like me, I prefer to place anchors into my comment templates so I can link directly to the comment in question. EE already generates anchors for comments, but you have no control over where in your template they appear (they’re always the first thing in a comment) and they are numbered relative to the entry itself rather than the actual comment ID number. So I build my anchors by hand by putting in code such as the following:

<a name="c{comment_id}"></a>

And I put that where I want the anchor to go in my comment template. Then in the Comment Notification email I use the handy variable tag to build the URL. Here’s the complete text for my User Comment Notification emails:
Email Title:

[{weblog_name}] New Comment Posted to {entry_title}.

Email Message

{name_of_commenter} just responded to an entry you subscribed to titled: {entry_title}

You can see the comment at
{unwrap}
{comment_url}#c{comment_id}
{/unwrap}
{comment}

To stop receiving notifications for this comment click here.
{unwrap}{notification_removal_url}{/unwrap}

You’ll find that a similar {trackback_id} variable exists for doing something similar with the Admin Trackback Notification emails.

3 thoughts on “Some useful new tags in ExpressionEngine 1.1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.