根据日期更改我的导航 [英] Changing my navigation based on date
问题描述
我希望我的网站根据日期显示不同的季节性项目.目前,我使用以下代码调用右侧导航的顶级冬季项目"部分:
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'); ?>
有没有办法可以使用基于日期的 php 包含?所以如果是 1 月 14 日,调用/stub_favorites.php,但如果是 3 月 10 日,调用 stub_favorites1.php?我是 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.
我的网站如下:http://www.merrimentdesign.com
推荐答案
看看 PHP 的日期/时间函数:http://php.net/manual/en/ref.datetime.php
Take a look at PHPs Date/Time Functions: http://php.net/manual/en/ref.datetime.php
您可以执行以下操作:
if (date('m/d/Y') < date('m/d/Y', strtotime("12/1/2011"))) {
//Display something
}
else {
//Display something different
}
这篇关于根据日期更改我的导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!