.:∴ Archives ∴:.
Tierra Verde

Monday, January 26

Administrivia  


I've got a sticky box above, as you can probably see. So, if I have something that needs to be up front for awhile, I can cut/paste the HTML into a file and upload the file. And I don't even have to republish anything in the blog. I don't neccessarily have a reason right now for this, but I figure I might down the road. And when I'm done with the sticky, I just kill the file, and everything goes back to the way it was looking before. Pretty neat in my book. Took a lot more time than it should have, but hey, that's them breaks. I learned a little of PHP doing it (the PHP figures out if the file exists, and if it does the prep work for displaying the file and displays the file. Otherwise, it does nothing)

Update

What the heck. Here's the PHP code:
<!-- Place for the sticky box (placeholder only for now -->

<?php
$stickyinput="./insert.html";
if(is_file($stickyinput)) { ?>
<script type="text/javascript">document.write("<div class='" + LightAndDark[whichbox] + "'>"); whichbox^=1</script>
<noscript><div class="boxedLight"></noscript>
<h2>The sticky notes at the front of the page</h2>
<?php
@readfile($stickyinput);
print "</div>";
}
?>
The JavaScript alternates the light and dark boxes if you have JS enabled. Otherwise it's just the light box without it. I already used the code for the blog, so that was an easy lift. So, I check if the file exists, and if so, output the setup, the the readfile reads and appends the file to the output (the page that is rendering). I could have done the ending </div> to match what I did earlier, but that works as well.

Permanent link posted by bytehead @ 1/26/2004 01:52:00 AM   Edit this entry 0 comments Links to this post

0 Comments:

Post a Comment

Links to this post:

Create a Link

 

Article Index

Administrivia
Copyright © 2003-2008, Bryan Price. Licensed by Creative Commons License: Creative Commons License
Home| This page| Colophon| Disclaimer| Privacy Statement