[thelist] Update styles based on date with PHP?

Max Schwanekamp lists at neptunewebworks.com
Mon Sep 18 14:31:24 CDT 2006


> From: Jono 
> > I assume that the calendar items are being generated by PHP 
> > too, right?
> No, no database, but that would be ideal - I am just good enough with 
> PHP (yet) to set up a db for such a thing.

A db, or at least a flat-file data source, is probably a good idea for this.
That said, you could hard-code something like my example then:
<tr class="<?php if (strtotime('9/19/2006') < time()) echo 'expired'; ?>">
  <td class="format"><a href="#" class="external">Talk Like a Pirate
Day</a></td>
  <td>September 19</td>
  <td class="last">Charleston, SC</td>
</tr>
<tr class="alt <?php if (strtotime('10/19/2006') < time()) echo 'expired';
?>">
  <td class="format"><a href="#" class="external">Event Number Two</a></td>
  <td>October 19&#8211;22</td>
  <td class="last">City, State</td>
</tr>

If you'll be making regular use of a calendar though, a prefab solution is
probably the way to go.  Others may have good suggestions on that count.

-- 
Max Schwanekamp
NeptuneWebworks.com






More information about the thelist mailing list