0
我有这样的代码捕获日期和时间:显示不同的模板
date('F j, Y, g:i a T')
,并保存作为
$datetime:
,我有这样的代码包括模板:
function template_contents($file, $model) {
if (!is_file($file)) {
throw new Exception("Template not found");
}
ob_start();
include $file;
$contents2 = ob_get_contents();
ob_end_clean();
return $contents;
}
if($datetime == "No Date Yet"){
echo template_contents("post.php", $model);
} elseif($datetime == "June 2, 2010, 2:55 pm MDT"){
echo template_contents("notpost.php", $model);
}else {
echo template_contents("post.php", $model);
}
我的希望编辑ELSEIF语句显示notpost.php模板,如果在$日期时间小于 2天。所以,notpost.php显示两天,post.php显示两天后。
这是一个自动过程,你的控制日期是硬编码? – Zuul 2010-06-02 22:07:10