【发布时间】:2010-10-17 04:49:05
【问题描述】:
我在我使用的主题中的模板预处理功能中设置了会话变量,但是第一次打开站点时我无法读取会话变量,如果我刷新页面它工作正常,有人知道可能是什么问题吗? ?
这是我在预处理函数中使用的代码:
function m_preprocess(&$vars, $hook) {
$default_location = array(
'country_code' => 'ec',
'province_code' => 'p',
'province' => 'Pichincha',
'city' => 'Quito',
'city_path' => 'lugares/u/ec/p/*'
);
if (isset($_COOKIE['proximity_path'])) $default_location['proximity_path'] = $_COOKIE['proximity_path'];
$default_location['path'] = isset($_COOKIE['sort-by']) && $_COOKIE['sort-by']=='proximity'? $_COOKIE['proximity_path'] : $default_location['city_path'];
$_SESSION['location'] = $default_location;
}
【问题讨论】:
标签: templates drupal session themes preprocessor