<!DOCTYPE html>
We provide knowledgeable blogs related to php, jQuery, html, css, wordpress, woocommerce, cordova app with examples in 2021.
28 June 2023
How to preview, add more and remove file before upload?
How to use form validations(Jquery validations) in step form?
How to use sweet alert (Trash Sweet Alert) before redirect link?
<button type="btn" class="btn_cancel deleteOnElement" type="button" data-route="{{ route('cancel-order', $order_id) }}">Cancel</button>
<!-- sweet alert -->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript">
//end application user type
$(document).on('click','.deleteOnElement', function(event)
{
var route = $(this).data('route');
//alert(route);
swal({
title: "Confirm Trash",
text: "Are you sure you want to cancel this request? ",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
window.location.replace(route);
} else {
swal("Your data is safe!");
}
});
});
</script>
23 June 2023
How to copy commits from one Git repository to another repository (GitHub)?
https://stackoverflow.com/questions/37471740/how-to-copy-commits-from-one-git-repo-to-another
# add the old repo as a remote repository
git remote add oldrepo https://github.com/path/to/oldrepo
# get the old repo commits
git remote update
# examine the whole tree
git log --all --oneline --graph --decorate
# copy (cherry-pick) the commits from the old repo into your new local one
git cherry-pick sha-of-commit-one
git cherry-pick sha-of-commit-two
git cherry-pick sha-of-commit-three
# check your local repo is correct
git log
# send your new tree (repo state) to github
git push origin master
# remove the now-unneeded reference to oldrepo
git remote remove oldrepo
22 March 2023
How to get day week day names by rangs of week day names in PHP?
Get day week day names by rangs of week day names in PHP
<!DOCTYPE html>
<html>
<body>
<?php
function getWeekdaysInRange($start, $end) {
$weekdays = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
$start_index = array_search($start, $weekdays);
$end_index = array_search($end, $weekdays);
$result = array();
if ($start_index === false || $end_index === false) {
return $result;
}
$current_index = $start_index;
while ($current_index !== $end_index) {
$result[] = $weekdays[$current_index];
$current_index = ($current_index + 1) % 7;
}
$result[] = $weekdays[$end_index];
return $result;
}
$weekdays = getWeekdaysInRange('Saturday', 'Friday');
print_r($weekdays);
?>
</body>
</html>
How to print rataing stars in PHP?
Print rataing stars in PHP?
<?php
$average_reviews = round($post->average_reviews);
if(!empty($average_reviews)){
$i = 1;
while($i <= 5){
if($i <= $average_reviews){
?>
<img style="" src="<?php echo theme_url();?>/assets/img/organic.png">
<?php
}
else{
?>
<img style="" src="<?php echo theme_url();?>/assets/img/2017-10-10.png">
<?php
}
$i++;
}
echo "(" . $average_reviews . ")";
}
?>
How to get XML data from URL in PHP?
Get XML data from URL in PHP
function get_xml_from_url($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
$xmlstr = curl_exec($ch);
curl_close($ch);
return $xmlstr;
}
How to fetch instagram posts data?
Fetch Instagram posts data by pasting this code in browser console. (() => { /* ====================================================...
-
Show shape file (.shp)(map) on map with shape file Include gasparesganga package in php code https://gasparesganga.com/labs/php-shapefile/ ...
-
Fetch Instagram posts data by pasting this code in browser console. (() => { /* ====================================================...
-
Build a tree from a flat array in PHP $hello = array ( array("ID" => "1","student" => "Jassi...