我正在十月 CMS 中构建一个使用斜线页面的网站。启动页面仅应在非 cookie 用户第一次访问该站点时显示给他们。我通过一个名为 splash 的插件中的组件来控制这部分。这是我的 onRun() 函数:
public function onRun()
{
$key = 'shownsplash';
if(!Session::has($key) || !Cookie::get($key))
{
$this->page['showsplash'] = true;
Cookie::queue('shownsplash',true);
Session::put($key,true);
$resp = NULL;
}
}
在我的名为“默认”的主页布局中,我想使用以下内容有条件地加载名为“splash”的启动页面模板:
{% if showsplash %}
{{ loadpage('splash') }}
{% else %}
Regular page template
{% endif %}
除了我不确定如何有条件地加载页面。另一个要求是启动页面采用 url http://www.example.com而不是任何后续页面。谁能指出如何做到这一点?