Usually we download the files hosted in same server using php, but in this tutorial we are showing how to download a file hosted in remote server.
PHP
How to get GMT date time in Magento 2?
Magento 2 usually saves the time in GMT in database, but display on admin or frontend will be based on the selected timezone. Use the below code to get the time with GMT timezone from Magento 2 code. Magento comes with DateTime php class, Magento\Framework\Stdlib\DateTime\DateTime is used for Forms GMT date. <?php public function __construct( […]
How to create a Controller in Magento 2?
Controller is one of the most important thing in MVC Frameworks in general, so the same in Magento 2 as well. It’s very duty is to receive the request, process and render to user. In Magento 1 there was one controller and it accommodates all the CRUD routes or other relevant routes. But in Magento […]
How To Get The Collection Of Records From A Custom Module In Magento 2?
If you are working on a custom Magento 2 module, and wondering how to get the collection of records from your custom database table, this article is for you. This is very common that your Magento 2 website needs more database tables than what Magento shipped with. So in a listing page such as blog […]
Removing whitespace characters in PHP
Today’s guide we are talking about the white spaces in strings and how to remove white spaces in PHP. The normal way to remove white space is using str_replace. Remove whitespaces using str_replace str_replace is very simple and powerful for removing whitespaces. Use the below script to see this in action. <?php $str = “he […]
Disable versions in Magento 2
By default Magento 2 static urls have a version string attached to it. For example, if you take the view source of the page, you will see urls contains the following string -version1490119662.
Installing Composer on Mac OSX
Composer is a dependency management tool for php projects. By using composer, you can just declare the dependecy in your project and composer will handle/download this for you.
How To Create A Custom Taxonomy In WordPress
Today’s tutorial we are showing how to create a custom taxonomy in WordPress. After WordPress 3 this feature is included in the core, so we just need to use the function with some params. The core developers created function to handle the heavy lifting for us. Why Custom Taxonomies? As your system/website grows you feel […]
Drag and Drop File Upload using DropzoneJS and PHP
Today’s article, we will show you how to drag and drop an image file using dropzonejs and PHP. Dropzonejs library provides us options for multiple uploads feature. For this we have one index.php, dropzone repo, and upload.php files. We use bootstrap css to help us to sort the stylesheets. Download the dropzonejs by clicking here […]
Using PHP glob() Function to Find Files in a Directory
It is very common that you may want to list out all the files in a directory that contains several levels of sub directories. So consider the below folder structure media sample.jpg foo.txt get.php PHP has a built in function called which comes handy while handling files and directories. Best thing about this function is […]
Hierarchical Tree view Category Example in Laravel
Most of the projects you work in PHP or in any language, there you have to encounter with categories and sub categories. When comes to categories, tree view is the best listing method that we can use in our web apps. In this article, we are showing you how to create Laravel tree view for […]
PHP str_replace() Function
replaces all occurrences of search string with a replacement string. Syntax str_replace(find, replace, string, count) find(required) – It specifies the value to find. replace(required) – It specifies the value to replace the value in find. string(required) – it specifies the string to be searched. count(optional) – it is the variable that counts the number of […]
How to Copy a File From One Folder to Another With PHP?
Today’s article, we will show you how to copy a file from folder to another by using PHP. For this we use default PHP function . Basically, it has two parameters to work a copy function. This file will overwrite if the file already exists in the folder. See the below example function. <?php $file […]
Ajax Image Upload using PHP and jQuery
Today’s tutorial, we are showing uploading an image using ajax and saving into a folder in server. In the past, we have seen many tutorials that explains how to upload an image using html and PHP. This tutorial too use PHP to upload the image, but uses the asynchronous techniques of Javascript via jQuery. This […]
20+ Best Magento Website Templates Free & Premium
Ultimo – Fluid Responsive Magento Theme Demo Download/More Info Porto | Ultimate Responsive Magento Theme Demo Download/More Info Shopper – Magento Theme, Responsive & Retina Ready Demo Download/More Info Fortis – Responsive Magento Theme Demo Download/More Info Fastest Demo Download/More Info Market – Premium Responsive Magento 2 Demo Download/More Info Claue Demo Download/More Info Black&White Demo Download/More Info Everything | Multipurpose Responsive Magento […]
Magento 1: Assign/ Remove category from a product.
This tutorial will show how to assign or remove a category from a product in Magento 1. I have used the standalone script, but you can use this in any module. Assign a category to product $productId = 2000; $categoryId = 200; Mage::getSingleton(‘catalog/category_api’)->assignProduct($categoryId,$productId); Remove a category to product $productId = 2000; $categoryId = 200; […]
Magento1 – Remove existing Media Gallery and Add New One at same loop
Below script helps you to remove existing images from the media gallery and add a new one at the same time to avoid duplicates in Magento 1. The following script will be very helpful while importing images bulk to Magento website.
Laravel Auth: Login with username instead of Email
Setup Project Update the .env file with your desired database details. Run the following command to create the scaffold for authentication pages. Next, we want to add our new field, username to our database migration structure. Open this file database/migrations/create_users_table.php. Add the username field in the up() function after the name field. So the final […]
MySQL CONCAT() Function
If you want to join several strings together in MySQL you can use the CONCAT function. Syntax Example
How to Convert PNG to JPG with compression in PHP?
Use the below snippet to Convert PNG to JPG with compression in PHP.
Laravel Image Intervention Tutorial With Example
How to use Intervention Image in Laravel 5 with Example. In this tutorial we will show how to use Intervention image manipulation package in Laravel. Basically we use this package to upload an image and resize it in the server. Common use cases are upload users photo or upload a product image etc. Laravel Image […]
How to get all days and date for a given month?
This is to get all days and date for choosen month. Just follow the code to display all the dates for a month. $month = “07”; $year = “2018”; $startDate = “01-“.$month.”-“.$year; $startTime = strtotime($startDate); $endTime = strtotime(“+1 month”, $startTime); for($i=$startTime; $i<$endTime; $i+=86400) { $list[] = date(‘Y-m-d-D’, $i); } print_r($list);
Get YouTube Video Thumbnail URL using PHP
YouTube is the world’s favorite video search engine. It’s very common now people use YouTube video in their websites/blog. Today’s tutorial we are demonstrating how to fetch YouTube video thumbnail using PHP. Basically this simple PHP script fetch YouTube thumbnail image from a full YouTube video URL. Get Thumbnail Image URL from YouTube Embed Code […]
Sending emails through Mailgun using Codeigniter
This tutorial provides step by step guide to send email using mailgun SMTP using Codeigniter. Mailgun is a powerful API that enables send,receive and track emails. Step #1 Let’s create a config.php file in the config/email.php and define $config array in it. You do not need to load this file manually, as the Codeigniter will […]
Basic Database Connection using PDO in PHP
In this tutorial we are going to learn connecting to MySQL with PHP using PDO. “PDO – PHP Data Objects – is a database access layer providing a uniform method of access to multiple databases.” You don’t need to worry about different syntax for different database types, PDO will do this painless. # connect to […]
How to get Query Strings Value from a URL in Laravel 5.5?
When you work with Laravel it is very common to get query string values from URL. In native PHP you can get this via $_GET variable. But when you want to get Query strings from a URL in Laravel you can use the below methods. Either you can use Request Facade or Input facade in […]
PHP GET and POST Method
When we are using html form, we can send data to another page using two different methods POST method GET method Both serves same purpose, but the internal mechanism is bit different. When using GET method key value pairs are passing through browser navigation bar. But for POST method a visitor cannot see the data […]
How to capture screenshot of website from URL in PHP
You may have a requirement to show the website’ screenshot in certain pages. You can use some third-party paid services for that. But here we are demonstrating a free service, that too from Google. You can write your own script to get the screenshot from URL. Basically, Google PageSpeed Insights API is used to analyze […]
CodeIgniter – Basic Concepts
Codeigniter is a small footprint MVC framework that helps programmers to create robust web applications. It is considered as one of the smallest frameworks when coming to the size and learning curve. What are the basic concepts in codeigniter ? Controllers Controllers are the entry point in any web application. So controller does same duty […]
Ways To Redirect URLs to Another web page
Different ways to redirect one page to another, this tutorial describes that. You can use different programming/scripting languages to achieve this. We can use server side programming language or client side scripting language like HTML, Javascript. Redirect using PHP Redirect using HTML meta tag Redirect using Javascript timeout function