Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Topic closed
#1 2007-07-10 00:57:09
- zenigy
- Archived Plugin Author

- From: San Diego, Ca
- Registered: 2007-07-09
- Posts: 4
[archived] zen_css: Change your stylesheets based on time
Notice: This thread is archived, this plugin is no longer available.
**********************************************************
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, changed to reference local GMT time vs. server time
v0.5 Added nodefault attribute, fixed example code typo in help file ;)
Link
Last edited by zenigy (2007-07-12 12:51:21)
Offline
#2 2007-07-10 01:37:11
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [archived] zen_css: Change your stylesheets based on time
Hi Linda. Cute idea for a plugin.
…after reading Gr3y’s post I don’t know if I was supposed to do that before I got my prefix…
For other would-be plugin authors: there’s no specific order, things are rather relaxed. Just make sure you add your prefix within a reasonable amount of time, on the off-chance someone else already has it or tries to snag it before you do.
I noticed something: your plugin won’t work for most users, as you’ve specified the url as admin/css.php (modified admin directory), rather than textpattern/css.php (shipped admin directory). For a future version, you might want to have it use the timezone as specified by the individual Txp install, rather than the server itself.
:)
Offline
#3 2007-07-10 01:47:58
- zenigy
- Archived Plugin Author

- From: San Diego, Ca
- Registered: 2007-07-09
- Posts: 4
Re: [archived] zen_css: Change your stylesheets based on time
your plugin won’t work for most users, as you’ve specified the url as admin/css.php (modified admin directory), rather than textpattern/css.php (shipped admin directory)
Yes, I saw that right after I posted it :) Fixed it now.
Last edited by zenigy (2007-07-10 01:54:46)
Offline
Pages: 1
Topic closed