从两天开始,我试图添加一些条件,将添加的促销的到期日期与今天的日期进行比较。如果它已过期,那么我想在促销文本上显示:"促销已过期.."
所以像这样:
$today = date( "Y-m-d" );
<div class="main-news-content" <?php if( [xfvalue_expiration] < $today ){ die "this promo is expired" ;}?>>
{short-story limit="300"}<div style="clear: both;"></div>
<div class="main-news-line"></div>
<div class="infocoupon">
<b>Ajouter : </b> {date} | [xfgiven_expiration] <b>Date D'expiration :</b> <span class="blink">[xfvalue_expiration]</span> [/xfgiven_expiration] {rating}
</div>
</div>
但是没有结果!我怎样才能得到今天的日期?数据生活是否接受她的脚本上的 PHP 条件?Ps:我将我的代码添加到页面短篇小说中。
您不能将 php 代码输入到 tpl 文件中。
您必须在 Engine/Modules/show.short.php 中设置标签,靠近这一行:
$news_date = $row['date'];
打开文件索引.php (最新版本的引擎/模块/主.php)
找到:
echo $tpl->result['main'];
替换为:
eval (' ?' . '>' . $tpl->result['main'] . '<' . '?php ');
和
在main.tpl中,你可以放置php