ExpressionEngine Add-on: SuperGeekery DayPhrase

Feature image

Eight Days a Week?

During a recent update to this site, I made a small ExpressionEngine add-on, SuperGeekery DayPhrase, to deal with a blurb of text that changes based on the day of the week in the footer. “Earth-shattering, it is not,” as Yoda might say, but since I built the previous version of SuperGeekery I’ve become aware of the benefit of not having any PHP in your templates. Speed.

Because of the way PHP is rendered in the ExpressionEngine parsing process, there is a speed benefit of eliminating PHP altogether from your templates. My ‘day phrase’ php block from the previous version SuperGeekery needed to be rewritten as an easy add-on to help speed up the page load.

The plug-in is not complicated to use. It’s a single ExpressionEngine tag that takes the name of a day of the week, lower-case, as a parameter and a string. For example, here’s a version of the tag showing all 8 possible parameters, including ‘default’.

    sunday="I'm feeling sunny."
    monday= "I'm going cyan."
    tuesday="I'm ready to go."
    wednesday="I'm talking turquoise."
    thursday="I'm feeling spooky."
    friday="I'm feeling funky."
    saturday="I'm going green."
    default = "I'm just showing a default message."

The ‘default’ value would never be seen in the case above because all 7 days of the week are defined. The ‘default’ value is only useful if you don’t define some of the days of the week. See this example:

    friday="I love Fridays!"
    sunday="The weekend is almost over. Bummer."
    default = "I'm holding out for Friday."

In this case, Monday - Thursday the tag would output “I’m holding out for Friday.” On Saturday, it would output nothing because the ‘saturday’ parameter is defined but set to nothing. That means it won’t inherit the default value because it is defined as an empty string. On Sunday the tag will output the message, “The weekend is almost over. Bummer.”

SuperGeekery DayPhrase supports NSM Addon Updater. It’s currently at version 1.1.

Price: FREE!

Download it from it’s GitHub page.

This plug-in also greatly simplifies the daily changing CSS colors that I mentioned in a past post.

There are no comments to this post.

Leave Your Comment:





your comment:

Remember my personal information

Notify me of follow-up comments?

Twitter Feed

John Morton talking on Twitter

Meanwhile on Instagram… //

My latest shot from Instagram.
Jazz history at the corner of 4th & Cooper Sq #nyc #jazz