Random Images
I said I would do some work on the foundation of this weblog.
See the sidebar over there, the one with my lovely mugshot? Yeah, that one. I hardcoded some of the info in there, in particular the section that includes my picture.
If you were to hit the refresh button, another picture would show up. Magic, huh?
Not really, but it did use a little PHP to get that impact.
Here's what I did.
1) Login to the admin section.
2) Click on Presentation.
3) Click on Theme Editor, then for this theme, I clicked on sidebar.php.
Here's where the PHP magic occurs.

That image might be a little tough to see, here's the important part.
<img src="http://www.davewooding.com/images/<? echo rand(1,6); ?>.jpg">
Note the php echo statement in there. Before I explain, I should tell you that I created 6 images to use for this and labeled them 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg and ... drumroll, please ... 6.jpg.
That php echo statement in there with the rand function says to pick a random number (1 thorugh 6) and print that out. Notice that it prints out in the middle of an image source statement - that's how I get a random picture to show up.






