if ( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) { //if ajax request your code runs here } else{ //if not an ajax request your code runs here }
Author: amiramgad
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string');
How to get featured image "thumbnail" for a post? $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo '$feat_image';
How to know the mode the browser running with ? i.e. Standards Mode, Quirks Mode ... In Firefox and Opera you can determine if your browser is in "quirks mode" by checking page info. Using document.compatMode, will tell you the mode you are in with most browsers. In Chrome, Safari, and IE, run this javascript in the address … Continue reading How to know the mode the browser running with ?
You can compress static files such as image files (.jpg, .png, ....), Flash files (.swf), Style sheets (.css), Javascript (.js) to reduce size of fetched files and make pages load faster. You can do gzip compression on these files via .htaccess file # 480 weeks <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=290304000, public" </FilesMatch> # … Continue reading gzip compression using .htaccess
To open new gmail compose email window use this url formation: https://mail.google.com/mail/?view=cm&fs=1&tf=1&su=Newest%20Questions%20-%20Stack%20Overflow&body=http%3A//stackoverflow.com/questions with parameters: - su: subject of the email - body: body of the email - view=cm: compose window also you can use these parameters: - "&to=" - "&cc=" - "&su=" - "&body="
To make cookies work globally on subdomains of a domain: setcookie('CookieName', 'Value', time() + 3600, '/', '.mydomain.com'); Note: remember to use the dot (.) in '.mydomain.com' not 'mydomain.com'
In many cases when we want to formulate complex queries, that need joins between tables, we can still add joins on the fly by adding it to the call of find $students_of_grade = $this->User->find('list',array( 'fields'=>array('UserData.user_id'), 'joins'=>array( array( … Continue reading CakePHP joining tables
By default a CakePHP controller uses a model with singularized name, for example a controller with name Students will use by default a model named Student, But if you want or have to change the default model for a controller you can set it using $modelClass member attribute for example for a controller named ClassesController … Continue reading CakePHP: change default model for a controller
How to check installation is either 32 bit or 64 bit ? you can simply type in terminal: getconf LONG_BIT It should result 32 or 64