Okay, admittedly, this is a pretty crazy and virtually useless tip. But it’s just one of those things that illustrates the flexibility of our craft and how sometimes solutions to problems can be found from some really outside-the-box thinking.
Back when I worked for a Toronto web design agency, we often had to update sites that were written in straight HTML, with no server-side programming at all. So every year, clients that owned such sites would ask us to update all the pages to display the current copyright year. That was pretty lame. Not exactly the kind of work we wanted to be doing.
So, one of our crafty PHP developers thought of doing this:
It’s just a regular HTML
<?php echo "document.getElementById('date-holder').innerHTML = '".Date('Y')."';"; ?>
Why Would You Need to Do This?
But I thought this was a great example of some really crafty thinking, and it helped us get out of a little jam, while still utilizing server-side resources on a static site. It also minimized the amount of code used. And if nothing else, it’s interesting to see that the
<script> tag can load pretty much any kind of file.
Are there any security issues with this? I really have no idea. I believe there are tracking applications and web counters that have used this approach. Would be interested to hear if anyone has any input on this.