| « Killer Bees (a plugin) | TuringTest v246 » |
Wanna see me naked?
Of course you do! Everyone wants to see me naked, and get naked, on CSS Naked Day. This year it'll be April 9th. And what is CSS Naked Day? Basically strip the styles from your web and experience "content and only content and nothing but content". And be naked all day ![]()
In b2evolution it's gonna be a bit tricky to pull this off, but hey it'll be two files. Maybe more if you use multiple skins, but only two files names is what I mean. There are 5 ways styles can be brought into the head section, so 5 of them are going to be wrapped in an if/else statement. I'll provide a .zip of a stock _html_header.inc.php file after I describe the thing so bear with me. Get it? Like "bare naked with me"?
Follow up:
First let's look at /skins/_html_header.inc.php to get rid of the styles on the right day. Stripped down to the bits that matter, that file looks like this:
[codeblock lang="php" line="1"]
... trigger_event( 'SkinBeginHtmlHead' ); ?> ... disp( 'blog_css', 'raw'); $Blog->disp( 'user_css', 'raw'); ?> [/codeblock]So what we gotta do it hide all those bits on April 9th, and replace it with a call to a non-existent style sheet. Unfortunately that might also remove javascripts and possibly some meta-tags that are provided by either plugins or skins, but that's the idea eh? SEPARATE style from content, with javascript and meta-tags on the 'content' side of that divide. So this is a bit of a problem inherent in b2evolution: no clear delineation between the two in how bits get brought into the head. Anyway it'll look like this when you're done:
[codeblock lang="php" line="1"]
f( is_naked_day() ) { echo ''; } else { $Plugins->trigger_event( 'SkinBeginHtmlHead' ); echo ''; include_headlines(); $Blog->disp( 'blog_css', 'raw'); $Blog->disp( 'user_css', 'raw'); } ?> [/codeblock]dified /skins/_html_header.inc.php for your enjoyment, and do backup your file just in case you don't like what happens when you replace yours with this one.
Now we gotta make the function you just stuck in your head. Fortunately we can do that with the /conf/hacks.php file that you might not have. If you don't have a file with that name don't worry: if you create it b2evolution will read it. If you do have that file already then you have to add a function to it. Again there will be a .zip after a little bit of code.
[codeblock lang="php" line="1"]function is_naked_day() {
global $localtimenow;
$m = 4;
$d = 9;
$y = 2009;
$start = date('U', mktime(0, 0, 0, $m, $d, $y));
$end = date('U', mktime(24, 0, 0, $m, $d, $y));
if ( $localtimenow >= $start && $localtimenow <= $end ) {
return true;
}
return false;
}
[/codeblock]
Here is my hacks.php zipped up which you can unzip and upload to your /conf/ folder. Of course if you have a hacks.php file you're going to have to merge the bit you need from mine to yours.
For the really adventurous and trusting, here are both files ready for you to unzip and upload to your server. THIS WILL OVER-WRITE TWO FILES IN TWO FOLDERS!!!