expressionengine - Conditional using site_url is always false -
i trying use following conditional statement in template:
{if "{site_url}" == "http://dev.site.com" } true {if:else} false {/if}
when test outputting site_url
in template http://dev.site.com
, expression evaluates false.
i've tried variations without brackets , quotes no luck.
try adding custom variable 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'] );
then change template be:
{if "{root_url}" == "http://dev.site.com" } true {if:else} false {/if}
or
{if "{domain}" == "dev.site.com" }
Comments
Post a Comment