10/19/2011

Remove unnecessary css from drupal website

To remove unwanted-style.css from current website do the following in your template.php

function MYTHEME_css_alter(&$css){

         unset($css['sites/all/themes/MYTHEME/css/unwanted-style.css']);
   
}

10/19/2011

Detect an iPad or an iPhone in PHP – HTTP_USER_AGENT

To detect an iPad or an iPhone in PHP use following function

function is_ipad_or_iphone(){
    if((preg_match("/iPad/",$_SERVER['HTTP_USER_AGENT']) or preg_match("/iPhone/",$_SERVER['HTTP_USER_AGENT'])) and preg_match("/Mobile/",$_SERVER['HTTP_USER_AGENT']))
        return true;
    else
        return false;
}

© 2023 Anil Maharjan