Tuesday, March 1, 2011

Week 8: Now With Content!

I spent the evening on some overdue Web development, and I missed it! It's fun to make my website bend to my will like a faulty dam before a storm tide. The first order of the night was to address the height of the page header. The CSS's default design is awful for my purposes here; a tall header and an enormous default picture combine to push the page's content two-thirds of the way down the page. Changing the picture was easy -- I replaced it with a much shorter placeholder graphic I hacked together in GIMP. (It looks just okay enough to put me in danger of letting the placeholder turn into the final product.) The header was harder. I couldn't figure out what part of the CSS code governed it. I fiddled with all the pixel heights to see what they did, even changed a bunch of colors to see if I could find the right part of the code, but the height of the header remained resolutely stuck. At last I figured it out, and the joke was on me: the "header" is actually nothing more than a cleverly designed, tiled background graphic! Once I figured that out, I booted GIMP again, shaved off a few dozen pixels, and elevated my content comfortably into the upper half of the screen.

Then came the part I'd been worried about. It was time to implement the central feature of the site: the array grab that populates the Verses page with a random poem. I built it up in my mind into an invincible monster made of PHP, server-side execution, and databases. To my amazement, though, everything went smoothly in a way that almost never happens in coding. My slightly-modified code pasted from StackOverflow.com worked perfectly (once I figured out that only the server could execute it, anyway). I didn't need a database, just a one-dimensional array in the form of a text file and the insight to realize that I could totally embed HTML elements into lines of the text array to create titles, line breaks, and so on. Then it was just a matter of figuring out that the page name had to end in .php, and just like that, my site had content. I quickly added a copyright notice. I should think about Creative Commons.

This thing ain't finished yet. I still need to add one major content element -- the news blog -- and revamp the site's look, especially that increasingly grating font. There's lots else, too, but those tasks stand out. Unfinished or not, though, there is now a reason for people to come to my website. And that is kind of cool!

No comments:

Post a Comment