How to add/implement a Click-2-Call link for your Mobile web page

If you have a mobile website and you need to add a click to call link this method could come in handy.If a visitor clicks on this link his mobile phone will prompt the user if he wants to phone the number specified. Add the following anchor tag to your code <a href="tel:1111111111">1111111111</a> Replace the 1’s with the correct number, please do not include any other characters or the + sign after tel: between the brackets, otherwise it won’t work.

March 22, 2018 · 1 min · 80 words · icarnaghan

How to adjust the width of a HTML combobox (Drop down box or Select box)

You can use external CSS (Cascading Style Sheets) or Inline Styles. NOTE: External CSS stylesheets are best to use. Example using inline styles. <select style="width:200px;"> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> Example using external CSS HTML <select class="dropdown"> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> CSS .dropdown{ width: 200px; }

March 22, 2018 · 1 min · 51 words · icarnaghan

How to alternate between 2 colors using PHP

This could come in handy if you have a table with multiple rows and if you wish to alternate between 2 colors. We’ll need to use the Modulus Arithmetic Operator for this (%). Modulus (%) gets the remainder after a division has been made between 2 numbers. eg. 3%2 = 1 Code Example: <table border="0" cellpadding="2" cellspacing="4"> <?php $rows = 10; //Number of rows for($i=0;$i<$rows;$i++){ //Looping through rows $a = $i % 2; //Modulus Calculation if($a == 1){ //If remainder is one we select grey as the color $color = "#3e3e3e"; }else{ //If there's no remainder the color will be white $color = "#ffffff"; } ?> <tr style="background-color:<?=$color?>"> //Applying the relevant color <td>Color 1</td> </tr> <?php } ?> </table>

March 22, 2018 · 1 min · 119 words · icarnaghan

How to auto submit a Sitemap to Google using PHP

This can be done via a ping service from Google Webmaster Tools Add the following PHP function function submitSitemap($site) { $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap='.htmlentities($site.'/sitemap.xml'); $response = file_get_contents($url); if($response){ echo $response; }else{ echo "Failed to submit sitemap"; } } Now you need to call the above function as example below to submit your sitemap to Google. submitSitemap('http://www.mysite.com'); //Replace http://www.mysite.com with your website Once the sitemap has been submitted the following message will be returned ...

March 22, 2018 · 1 min · 140 words · icarnaghan

How to Ban an IP Address using .htaccess

If you do not want a certain person/IP Address to access your website you can add the following code to your .htaccess file order allow,deny deny from xxx.xxx.xxx.xxx allow from all In the above code replace the xxx with the IP Address that you would like to Ban accessing your website

March 22, 2018 · 1 min · 51 words · icarnaghan

How to change the Return-path email address using the PHPMailer class

Fill the $Sender property with the email address you wish to have as the Return-path E.g. $mail->Sender="[email protected]"; This property can be found on Line 97 in the class.phpmailer.php file /** * Sets the Sender email (Return-Path) of the message. If not empty, * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. * @var string */ public $Sender = '';

March 22, 2018 · 1 min · 65 words · icarnaghan

How to change the url for Yii::app()->homeUrl in Yii

Open the main configuration file protected/config/main.php Now in the main.php file we can assign a Action or Url to homeUrl _highlight[1] = “\n\nreturn array(\n\n \‘basePath\’=>dirname(__FILE__).DIRECTORY_SEPARATOR.\’..\’,\n\n \‘homeUrl\’=>array(\‘site/login\’),\n\n ….\n\n”; return array( 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 'homeUrl'=>array('site/login'), ....

March 22, 2018 · 1 min · 32 words · icarnaghan

How to check for empty values within a array using PHP

If you have an array called $array with the below values Array ( [0] => 1299016800 [1] => [2] => ) As we can see in the above example we have 2 empty values within the array, now how do we determine this using PHP First we get the size of the array $mainSize = sizeof($array); Now we get the size of the array without the empty values $emptySize =sizeof(array_filter($array)); Now we compare the 2 different sizes, if they are equal to each other, then it means that there aren’t empty values within the array, else there are empty values within the array ...

March 22, 2018 · 1 min · 121 words · icarnaghan

How to check if a Request was made via AJAX in PHP

// Check for Ajax Request if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { //Do stuff here }

March 22, 2018 · 1 min · 16 words · icarnaghan

How to check if an array contains a empty element or value

Use the following code example $array = array('a','b',''); //The array to check for empty values echo (in_array(' ', $array)) ? 'Empty values exists' :'No empty values'; ?> //Checking if empty values exist in the array NOTE: in_array = searches a array for a specific value

March 22, 2018 · 1 min · 45 words · icarnaghan