Sometimes you might want to turn off a block or a section of code in your site for the iPad.

A perfect example of this is our tag cloud in the header above - we don't wish to show this on the iPad as it defaults to the non-Flash text version, so, we need to detect the iPad and not show the code.

For this, we created a theme over-ride block "block-cumulus-0.tpl.php" which over-rides the default block.tpl.php in our theme.

The iPad user agent string is :-

“Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10″

So we inserted the following code to detect the iPhone/iPad and simply placed an if statement around the content :-

if((strpos($_SERVER["HTTP_USER_AGENT"], "iPhone") > 0) || (strpos($_SERVER["HTTP_USER_AGENT"], "iPad") > 0))
{
    //we have an iPhone/iPad
}else{
    //we have some other browser
}

Simples!