Automatically updating footer copyright dates

Webcrossing supports 2 different scripting languages: standards-based server-side JavaScript, and the older proprietary Webcrossing Template Language (WCTL). You don't have to know a lot of WCTL to develop in Webcrossing, but since WCTL can be used directly in settings fields in many Control Panel HTML fields (and JavaScript can't), it can be helpful to learn a smattering of WCTL to make your life easier. Here's an example you can paste directly into your Control Panel footer field.

If you are like me, updating the copyright dates in the footer of the sites you manage is not your idea of a fun time on New Year's Eve. But with the magic of a little WCTL, you can have automatically updating dates in the footer. And that will be your last footer date update.

Say you want your copyright date to say © 2011 My Company

This is all you need:
%% set year date(dateObj).dateFormat("Y4") %%
© %% year %% My Company


Or if it is 2011 now but you want your date next year to say © 2011-2012 My Company
%% set year date(dateObj).dateFormat("Y4") %%
© %% if year > 2011 %%2011-%% endif %%%% year %% My Company


This year it will say © 2011 My Company, and on January 1 next year, while you are sleeping in, it will say © 2011-2012 My Company.

No comments:

Post a Comment