Thumbnail creation example in Codeigniter 2.1.4. There is a file upload class, in codeigniter, which permits you to upload the file or files and also we can create thumbnail for the uploaded file as per our desired size. This class also permits you to set various preferences such as destination where the file and thumbnail will be uploaded, restrition on file types, restriction on file size, whether a file name should be encrypted or not, maximum length of the file name etc.
Below are the simple few processes for uploading a file and a thumbnail for this file Continue reading “Thumbnail creation example in Codeigniter”
File upload example in Codeigniter 2.1.4. There is file upload class, in codeigniter, which permits you to upload the file or files. This class also permits you to set various preferences such as destination where the file will be uploaded, restrition on file types, restriction on file size, whether a file name should be encrypted or not, maximum length of the file name etc.
Below are the simple few processes for uploading a file
A form with input type file is required so that user can select the file using the browse button
When the form is submitted, the file is validated to make sure that the file is uploaded against the preferences you set
Once the file is uploaded successfully to the specified destination, the success message is shown Continue reading “File upload example in Codeigniter 2.1.4”
HMVC stands for Hierarchical Model View Controller. Modular Extensions make the Codeigniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other Codeigniter applications. This allows easy distribution of independent components (MVC) in a single directory across other CodeIgniter applications.
Module Controllers can be used as normal Controllers or HMVC Controllers and they can be used as widgets to help you build view partials. Continue reading “Setup HMVC with Codeigniter 2.1.4”
This tutorial shows how to work with custom validation in Codeigniter. We need many times that a field has to be validated against some type of values but built-in features do not provide all kind of validation pattern, so we need to write a function which will be used as callback function for a particuler input field for validation purpose. The below example validates the date field and if the date is invalid then it displays an appropriate error message to the user. Continue reading “Custom validation example in Codeigniter”
This tutorial shows how to prevent browser caching easily in Codeigniter.
We face some kind of problems in real life when browser caches the data particularly when there are session data. Though we destroy session but still using back button users are able to view some data on browser. For example, when user logged in to the application they can easily go back to the login page using the browser’s back button. Again when user logged out of the application they can easily navigate to the previous page using browser’s back button.
So we can prevent browser caching data using some mechanism. So our below example will show how to achieve it easily in Codeigniter. Continue reading “How to disable browser cache easily in Codeigniter”
This tutorial shows how to remove index.php from URL in Codeigniter. We want to remove the index.php file so that URL looks good and it makes better readability. Also the clean URL is easy to remember.
Before you change anything in comfig.php and .htaccess file make sure you have mod_write enabled in the server ottherwise it won’t work. For localhost you can enable it yourself and for live server if it does not work then you can contact with the hosting company.
<root directory> – is the root directory under htdocs in localhost or public_html(live server) Continue reading “How to remove index.php from URL in Codeigniter”
This tutorial shows an example how to add input types text, textarea and file to the form. For this example I have used here jquery for dynamically adding inputs, css for some basic style and html code.
We have select/option for what type of input to be added to the form.
We have one <span/> tag with id=”addField” for triggering add functionality using jquery.
Each dynamically added input field has exactly one <span/> tag for removing the added input field if not needed later. Continue reading “Add input fields to form dynamically using jQuery”
The below example shows how to achieve it using jQuery. We have a button here and on clicking the button the values from array will be displayed one by one. There are two examples below, one simply access the values from an array and another displays the images from an array. Continue reading “Display elements one by one from an array using jQuery”