1. 文章发布时间的确定
如果服务器空间在国内还好说, 如果在国外的话, 文章编辑时间会是服务器的时间, 修改成自己的时区也很简单:
lib.php里, 加:
date_default_timezone_set(PRC);
2. 日期格式
entry或者page的日期格式tpl里使用的是 05 07 14 - 14:53 这个smarty的函数, 具体实现是:module_smarty.php
$this->register_function('date', 'smarty_date');
smarty_date函数里:
1557 // If we have a $params['use'], we take that value from the smarty object,1558 // else we check if $params['date'] is set, and use that.1559 // Then we check if there's a 'date' set in the smarty object.1560 // As a last resort we use '', which is evaluated as being 'now()'1561 if (!empty($params['use'])) { 1562 $date = $vars[ $params['use'] ];1563 } else if (!empty($params['date'])) { 1564 $date = $params['date']; 1565 } else if (!empty($vars['date'])) {1566 $date = $vars['date'];1567 } else { 1568 $date = ''; 1569 }1566 $date = $vars['date']; 这句最关键, vars是$smarty->get_template_vars();也就是所有调用assign赋值的变量集合, 但是我们没有看到类似 ->assign('date'的语句.
注意, renderEntry接口和renderPage接口里都有类似:
215 $PIVOTX['template']->assign('page', $page); // renderEntry里是$entry 216 foreach($page as $key=>$value) { 217 $PIVOTX['template']->assign($key, $value); 218 }
$page和$entry是从数据库里读出来的, 查看数据库的列信息, 发现了date这个列.
也就是此处, $PIVOTX['template']->assign('date', $value);这样date就赋值了.
也就是页面了, 调用05 07 14 - 14:53的地方, 实际获取的是entry或者page的date值, 也就是创建时间.
3. 格式
05 07 14 - 14:53默认格式是$format = "
