To Set Current Date as MinDate in the form 7 calendar [date* date-start min:today step:1 class:required] To Set Any specific Date as MinDate in the form 7 calendar [date* date-start min:2020-07-01 step:1 class:required] To Set MinDate after some days or week from current date in the form 7 calendar [date* date-start min:today+10days step:1 class:required] [date* […]
PHP
Summernote Image Attributes
If you want to add image attributes in summernote then please follow the steps– Step 1: load summernote jshttp://<script src=”https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js”></script> Step 2 : load summernote attribute jshttp://codersqube.in/wp-content/uploads/2024/01/summernote-image-attributes.js Step 3: Step 4: Add this js
Number format according to Indian Currency
One of the tasks I usually come across while working on some of the more commercial web applications is to display a number in INR i.e Indian National Rupee ( ₹ ) format which makes it really easy to perceive the number as Indian Rupees. Let me show you how to format a number to […]
- Codeigniter
- ...
Upload base64 to file in PHP
While we have working with API for mobile or web application , You will notice that they will send the format of images in Base64 encoded. So in that case, you will need to move the Base64 encoded image to server as a image file.and have to save it in the folder Example Core PHP: […]
Convert amount into Word Format In Rupee
public function getIndianCurrency(float $number)
{
$decimal = round($number - ($no = floor($number)), 2) * 100;
$hundred = null;
$digits_length = strlen($no);
$i = 0;
$str = array();
$words = array(0 => '', 1 => 'one', 2 => 'two',
3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six',
7 => 'seven', 8 => 'eight', 9 => 'nine',
10 => 'ten', 11 => 'eleven', 12 => 'twelve',
13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen',
16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen',
19 => 'nineteen', 20 => 'twenty', 30 => 'thirty',
40 => 'forty', 50 => 'fifty', 60 => 'sixty',
70 => 'seventy', 80 => 'eighty', 90 => 'ninety');
$digits = array('', 'hundred','thousand','lakh', 'crore');
while( $i < $digits_length ) {
$divider = ($i == 2) ? 10 : 100;
$number = floor($no % $divider);
$no = floor($no / $divider);
$i += $divider == 10 ? 1 : 2;
if ($number) {
$plural = (($counter = count($str)) && $number > 9) ? 's' : null;
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
$str [] = ($number < 21) ? $words[$number].' '. $digits[$counter]. $plural.' '.$hundred:$words[floor($number / 10) * 10].' '.$words[$number % 10]. ' '.$digits[$counter].$plural.' '.$hundred;
} else $str[] = null;
}
$Rupees = implode('', array_reverse($str));
$paise = ($decimal > 0) ? "." . ($words[$decimal / 10] . " " . $words[$decimal % 10]) . ' Paise' : '';
return ($Rupees ? $Rupees . 'Rupees ' : '') . $paise;
}
Get User IP address
function get_client_ip_server() {
$ipaddress = '';
if ($_SERVER['HTTP_CLIENT_IP'])
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if($_SERVER['HTTP_X_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if($_SERVER['HTTP_X_FORWARDED'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if($_SERVER['HTTP_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if($_SERVER['HTTP_FORWARDED'])
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if($_SERVER['REMOTE_ADDR'])
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}
Convert Number into Word Format In PHP
function convert_number($number) {
$ci = & get_instance();
if (($number < 0) || ($number > 999999999)) {
throw new Exception("Number is out of range");
}
$Gn = floor($number / 100000);
/* Millions (giga) */
$number -= $Gn * 100000;
$kn = floor($number / 1000);
/* Thousands (kilo) */
$number -= $kn * 1000;
$Hn = floor($number / 100);
/* Hundreds (hecto) */
$number -= $Hn * 100;
$Dn = floor($number / 10);
/* Tens (deca) */
$n = $number % 10;
/* Ones */
$res = "";
if ($Gn) {
$res .= convert_number($Gn) . " Lakh";
}
if ($kn) {
$res .= (empty($res) ? "" : " ") . convert_number($kn) . " Thousand";
}
if ($Hn) {
$res .= (empty($res) ? "" : " ") . convert_number($Hn) . " Hundred";
}
$ones = array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen");
$tens = array("", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eigthy", "Ninety");
if ($Dn || $n) {
if (!empty($res)) {
$res .= " and ";
}
if ($Dn < 2) {
$res .= $ones[$Dn * 10 + $n];
} else {
$res .= $tens[$Dn];
if ($n) {
$res .= " " . $ones[$n];
}
}
}
if (empty($res)) {
$res = "zero";
}
return $res;
}
Child Theme In WordPress
In WordPress, a child theme is considered a sub-theme that gets all of its features, style, and functionality from the parent theme. These are safe ways to make changes to the WordPress theme without really modifying the files of the parent theme. When the parent theme is updated, all of the changes made in the child theme […]
Embed a Facebook page’s feed into website Page
If you want to show a facebook page’s content into your website is’s simple, no programming required. Go to https://developers.facebook.com/docs/plugins/page-plugin/ and fill up the setting and then generate code. After generate code just paste the code into your webpage where you want to show facebook’s post. For sample :Paste the code into just after body […]
Merging PDF files
You might think that you could easily merge several PDF files into one using the convert command like this: Found this code from https://contactsunny.medium.com/a-few-basic-but-powerful-imagemagick-commands-b5809b0a1076