Content last modified Monday 3 September 2018
hop to #bottom
Categories:
Author:
Linda Phan
Current version:
0.5
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

zen_css

Timed CSS Stylesheet Swapper

This plugin changes the stylesheet based on the time. zen_css will load the specified stylesheet or it can append the default section stylesheets with specified text. During the times not specified, the default stylesheet for the section will load.

Attributes

Required Attributes

If these attributes are not set then zen_css will work just like textpattern’s css tag and will load the default css style for the section.

starthour = “0” – “24”
24 hour value of the time you would like the style sheet to start taking effect

endhour = “0” – “24”
24 hour value of the time you would like the style sheet to stop taking effect.

zen_css also requires one of the following attributes to be set in addition to the two above. If both are set, zen_css will load the stylesheet set for n.

n = “text”
Name of stylesheet to be loaded between the set times. e.g. n=“night_css”

cssappend = “text”
If you would rather not load one stylesheet for all pages, you can load the section default stylesheet with specified append text. e.g. cssappend=”_day”

Optional Attributes

nodefault = “0” or “1”
Set this to 1 if you would like to prevent zen_css from loading the default css file when the time is not within the hours specified. (Use this if you are loading 3 or more alternate stylesheets). default: “0”

Examples

The following will load the section default css with the append text “_night” (eg. default_night, about_night, etc) between 6am and 6pm, or the section default css at other times.

<txp:zen_css starthour="18" endhour="6" cssappend="_night" />

The following will load the css files “dawn”, “day”, “dusk”, or “night” depending on the hour, but will not load the section default css files.

<txp:zen_css starthour="5" endhour="8" n="dawn" nodefault="1" />
<txp:zen_css starthour="8" endhour="18" n="day" nodefault="1" />
<txp:zen_css starthour="18" endhour="21" n="dusk" nodefault="1" />
<txp:zen_css starthour="21" endhour="5" n="night" nodefault="1" />

Changelog

v0.4 Initial Release
v0.45 Fixed reference to local textpattern install folder
v0.5 Added nodefault attribute, fixed example code typo in help file ;)

Article Request Count:

Archived [?]: orphaned: broken download link

Keywords/tags:
Initially released:
6/9/07
Posted here:
09 Jul 2007

You know you want to visit the Archives.
Published with Textpattern