Render the current year for copyright lines in Page Wrappers and Stationeries

Options

Now that a new year is upon us, it's time for the age-old task of updating copyright lines. Here's a tip: instead of hard-coding the year in your Page Wrappers and Stationeries, use the following S-Tag. This tag will render the current year, and thus will never need to be updated!


]" dup length dup 5 - swap substring]]


Tagged:

Comments

  • Is there a way to do this in the CMS side of things? For example, a website footer using the T: date tags?

    Thanks in advance, very helpful!

  • Yes there is! Just create a local variable with today's date and display it using a format that just renders the year, like so:


    <t:set id="today" value="days(0)"/>
    <p>This year is <t:value id="today" type="date" format="yyyy">2010</t:value>

    That should do the trick.

  • And indeed it did. Thanks so much for this, now we don't have to manually revise all wrappers. What a pain!

Categories