Ok, thatโs how I decided it now. More domain names will also be implemented, at some point in the future. I donโt know what technique I will use.
# Setting options, single and dual part domain extentions $v2_onePart = array( "com" ); $v2_twoPart = array( "co.uk", "com.au" ); $v2_url = $_SERVER['SERVER_NAME']; # "example.com" OR "example.com.au" $v2_bits = explode(".", $v2_url); # "example", "com" OR "example", "com", "au" $v2_bits = array_reverse($v2_bits); # "com", "example" OR "au", "com", "example" (Reversing to eliminate foo.bar.example.com.au problems.) switch ($v2_bits) { case in_array($v2_bits[1] . "." . $v2_bits[0], $v2_twoPart): $v2_class = $v2_bits[2] . " " . $v2_bits[1] . "_" . $v2_bits[0]; # "example com_au" break; case in_array($v2_bits[0], $v2_onePart): $v2_class = $v2_bits[1] . " " . $v2_bits[0]; # "example com" break; }
Dirk v b
source share