This is the celebrated journal of Mr. Simon Collison A.K.A Colly

Monday’s Expression Engine snippet

7th 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…


# Paul Burdick responded on 8th November 2006 with...

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.

# allgood2 responded on 10th November 2006 with...

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.

# Simon Collison responded on 13th November 2006 with...

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…

# Stan responded on 16th November 2006 with...

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?

Responses are now disabled Your ability to respond is disabled automatically some 30 days after articles are published, or manually much sooner if spamming guttersnipes target a particular article.

Prev 659 Next

Superfluous Aside

Archived in ExpressionEngine, Design & Web

There are 4 responses

External References

Copyright © Mr. Simon Collison 2003-2017. Protected and licensed under a Creative Commons License. Grab the RSS feed

Engineered in Nottingham, scaffolded by ExpressionEngine, steam-pumped by United & kept alive with tea and hugs.