I am just wondering if there is a more concise / smarter way of doing this. I want a snippet to only load if the domain is the live domain. I have three variables in my config with live, staging and local set. So if the domain contains either staging or local, dont load the snippet. (it contains analytics tracking codes, so dont want false hits).
It seems to work with this:
<?php
$url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (strpos($url,c::get('staging')) !== false || strpos($url,c::get('local')) !== false ) {
// Local or staging
} else {
// Live
snippet('ga-header');
}
?>
I just cant help thinking theres a better or more accurate wayβ¦