我试图在我的模板中使用以下条件语句:
{if "{site_url}" == "http://dev.site.com" }
true
{if:else}
false
{/if}
当我在模板中测试输出site_url
时,我得到http://dev.site.com
,但此表达式始终评估为false。
我尝试过没有括号和引号的变体而没有运气。
答案 0 :(得分:2)
尝试在config.php(/ system / expressionengine / config / folder)中添加自定义变量:
//### Custom Variables ###
global $assign_to_config;
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$assign_to_config['global_vars'] = array(
"root_url" => $protocol.$_SERVER['HTTP_HOST'],
"domain" => $_SERVER['HTTP_HOST']
);
然后将模板更改为:
{if "{root_url}" == "http://dev.site.com" }
true
{if:else}
false
{/if}
或
{if "{domain}" == "dev.site.com" }
答案 1 :(得分:1)
您可以在https://expressionengine.stackexchange.com/中获得更好的答案,但解决解析订单问题的一些方法包括: