I would like my site to display different seasonal projects based on the date. Currently, I call the ‘Top Winter Projects’ section of my right navigation with the following code:
<?php include (TEMPLATEPATH . '/stub_favorites.php'); ?>
Is there a way that I could use a php include based on date? So if its January 14, call /stub_favorites.php, but if its March 10, call stub_favorites1.php? I’m new to php so bear with me.
My website is as followed: http://www.merrimentdesign.com
Take a look at PHPs Date/Time Functions: http://php.net/manual/en/ref.datetime.php
You can do something like:
The most dead easy way to display one include per month:
then add files:
the right file will be included for each month. The script will fail silently if a month does not exist. To make this work for calendar weeks instead, use
date("W");
. A full reference of date parameters can be found in the manual.