I created and uploaded a few banner images and so I thought I’d post my image-rotator code.
/* * rotating_banner.php * echoes an img tag populated w/ a random image from an array */ $arr_banner_images=array( 'banner.jpg', 'banner2.jpg', 'banner3.jpg', 'banner4.jpg', 'banner5.jpg', 'banner6.jpg', 'banner7.jpg', 'banner8.jpg', 'banner9.jpg', 'banner10.jpg', 'banner11.jpg', 'banner12.jpg', 'banner13.jpg', 'banner14.jpg', 'banner15.jpg', 'banner16.jpg', 'banner17.jpg', 'banner18.jpg', 'banner19.jpg', 'banner_containment.jpg' ); $dir_banner_location='/journals/ethan/images/'; $banner_width='700'; $banner_height='100'; echo '<img src=\''.$dir_banner_location.$arr_banner_images[rand(0, count($arr_banner_images)-1)].'\' width=\''.$banner_width.'\' height=\''.$banner_height.'\' border=\'0\'/>';
Of course, if I was on a Windows/IIS server, I could just use the ever-nifty <asp:AdRotator> web control.
In other geek news of possibly no interest (which is why I created a separate category for this stuff), I decided to use $45 of my cellphone largesse to participate in a 25 minute development conference call this week. I broached the topic of trying to maintain XHTML 1.0 compliance in all future projects. It was not a popular suggestion with a few of my colleagues. I was surprised by their hesitation to adopt this standard because a fair portion of the business is writing form input to XML documents and then later generating reports from those docs with XSLT. If the original form was XHTML 1.0, you could basically just use that for the report stylesheet with minimal rewriting. But you can never tell anybody anything.