المشاركات

عرض المشاركات من أبريل, ٢٠١٨

How to Create Custom Library in CodeIgniter

صورة
Hi, today let's see how to create custom library in codeigniter . CodeIgniter offers a rich set of libraries and helpers for robust application development. In general, a library is a class file used to group similar functionalities into a single file. Now we can do the same with helper but the libraries have their own object to store relevant data. Below I'll show you how to create your own class libraries in CI. You must store these library files inside the 'application/libraries' folder. This will keep them separate from the native libraries of the framework. CodeIgniter - Create Custom Library: CodeIgniter is a flexible MVC framework and allows you to, Create new custom libraries. Extend existing libraries to include additional functionalities to them. Replace native libraries completely with your own version. I'm going to show you an example where I create a custom library to export the database table as a json string. STEP-1) Create a library named

How to Import CSV File into MySQL with LOAD DATA INFILE

صورة
I tried to import a csv file into mysql with php script . It is a simple solution if you have a small set of data to import. But if you have hundreds of thousands of records, don't even think about it. You need something different to read through a large dataset quickly. MySQL's LOAD DATA INFILE command works like a charm and can be executed from the command line. Using LOAD DATA INFILE allows you to load csv or any other delimited data file to the mysql table with a single command. It comes with several options and we will see below what they are and how to use them to import the csv data set into the mysql table. Using LOAD DATA INFILE Command: The LOAD DATA INFILE command in mysql loads data from a file into the table at high speed. The file path specified must be absolute or relative. 1. Importing CSV File into MySQL: Let's say we have a mysql table 'customers' with the following structure. MySQL Table: Customers CREATE TABLE `customers`( `id` INT

How to Add Select All Options to jQuery Select2 Plug-in

صورة
Hi, in this post let's see how to add select all options to jQuery Select2 plugin . Select2 is an excellent alternative to the standard HTML selection box that supports all its functions and provides greater flexibility. The plug-in is easy to setup and use. It supports multiple selection options where the selected elements will be added as pills to the top text box. You can also tag, search and load remote data-sets to select2 control. Below we will see how to use select2 in your web projects, and select all options at once by ticking a check box using jquery. How to Use Select2 jQuery Plug-in? To implement Select2 plug-in in your projects, create a regular drop-down box with html markup as usual. HTML: <select id="states" style="width:300px"> <option>Alaska</option> <option>Arizona</option> <option>California</option> <option>Florida</option> <option>Hawaii</option>

Send HTML Email in PHP via SMTP

صورة
Hi! Welcome to Koding Made Simple . Today we'll see how to send html email in php . PHP's mail() function is simple and effective and let you send emails with text/html contents and with attachments. Though it has some shortcomings compared to other mailer libraries like PHPMailer , it does the job and comes in-built with PHP package. Plain text emails are good enough, but the ability to send html emails is more powerful in email marketing and other promotions. HTML emails include html tags and let you add images, format texts and other eye-catching call-to-action buttons etc. But you have to add additional headers for mailing them. Using SMTP for Sending Email You can send mails via third party Mail Servers but you need authentication first. That is if you want to send email via Gmail in php, then you must have a working gmail account and provide the accounts email-id and password for authentication. We'll see how to set up the php configuration for sending ema

How to Disable Mouse Right Click using jQuery

صورة
Content theft is a serious issue faced by many website / blog owners. This can be limited to a certain level by disabling right click on websites. Disabling mouse right-click will prevent the context menu from appearing, there by preventing the page contents from being copied. Although it is not recommended as the best practice, it is certainly feasible. It is very easy to disable the right click on your site using jquery. You can do it at page level or element level. You have to capture and cancel the event inside the event handler. We will see how to do it. jQuery - Disable Right Click Context Menu: You can avoid copying the contents of your website in two ways. One is to disable the right-click context menu altogether and the other is to simply disable the cut, copy and paste operations. 1) To disable the right-click event on the entire web page, use this script, <script type="text/javascript"> $(document).ready(function(){ $(this).on('contextmenu'