Monday’s Expression Engine snippet
6th November 2006
During my tenure as guest author, I’ve not got around to talking about anything other then Expression Engine. So, to continue the trend, here’s a quick snippet of hopefully-useful code for Monday. There’ll be another snippet each day this week.
The old last updated on chestnut appears on site after site. Indeed, if you head due north from this post, you’ll see Colly using it. It’s easy to do in Expression Engine, and it shows how weblog tags can be used to accomplish all sorts of things that aren’t directly-related to displaying blog entries. Simply use: -
Updated on {exp:weblog:entries limit="1"}
{edit_date format="%F %n %S, %Y"}{/exp:weblog:entries}
All we’re doing here is using a weblog tag to pull out the date of the most recent entry for any weblog. Obviously this means the updated date only refers to the last entry you’ve edited, and not to any other changes throughout your site. And it’s worth pointing out that we’re using edit_date rather than entry_date, a subtle but useful difference when you’re building editorial workflow (or a metadata schema) that requires both a creation and modification date.
More tomorrow…
Simon Rudkin published this on 06/11/06, at 6:43 PM
Comments
Perhaps this would be a key time to point out how the usage of the disable="” parameter can help reduce how much effort ExpressionEngine must expend to parse a tag? When only outputting a single variable like this, it likely removes the need for three or four queries.
07/11 at 19:13 from Paul Burdick
Good point from Paul. I know, I use a number of small queries like this to do things like modify meta-tags to relate to a specific article, update data, etc. and I often forget to add the disable parameter, even though I know it will improve speed and performance.
09/11 at 17:00 from allgood2
I am lame at remembering to disable unused weblog info too. I always forget, but it is a brilliant query-saving tip. I think EE is one of the best tools for caching and reducing database abuse. Another example of the system being well thought out and readied for the real world.
Off I go to start adding disable parameters to about thirty websites…
13/11 at 00:57 from Simon Collison
Is it still necessery to disable trackbacks if they are disabled in the weblog settings. Same for categories if they are none created nor asigned?
15/11 at 21:25 from Stan
Note that comments are disabled 30 days after articles are published, or sooner if spammers target a particular post. Sorry...
















