Using Template in Codeigniter 3

This tutorial will show you an example on how to use template in Codeigniter. In an web application a template is recommended because there are certain regions or areas which are common to all pages and only the body portion of the page gets changed. Common areas like header, footer, left sidebar or right sidebar are mainly common areas for most of the web applications. So we will fix those common areas in the template file so that every page will use those common areas in the application and body portion of each page will contain content which is specific to the page.

We will use here Colin Williams template library to demonstrate the template system in Codeigniter. Now-a-days the Williams Codeigniter Template library is no longer being supported or improved, the last version produced was 1.4.1. So to make it work with Codeigniter I have done a little modification to it.

We will use here the same application as I have shown in https://www.roytuts.com/setup-hmvc-with-codeigniter-3/ but the only thing change here is I will use Template library instead of loading the view file.

If you want to use Template library with Codeigniter 2 then you can read https://www.roytuts.com/using-template-in-codeigniter/ Continue reading “Using Template in Codeigniter 3”

Setup HMVC with Codeigniter 3

This is an example on HMVC Codeigniter 3. 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.

You can also use HMVC with Codeigniter 2. Please read here https://www.roytuts.com/setup-hmvc-with-codeigniter-2-1-4/

Prerequisites

XAMPP in Windows
Netbeans 8.1
Codeigniter 3.0.6 Continue reading “Setup HMVC with Codeigniter 3”

Separating Front-end and Back-end in Codeigniter

This tutorial will show you an example on how to we can separate front-end and back-end in Codeigniter. Front-end which is mainly used by public users who navigate through the site and sometimes register themselves to get updates on the site activities, new posts, update on a particular post etc. Back-end which is mainly used by site author, administrator, editor etc. to manage the site. So back-end will be restricted to some people with given roles.

Here I can use different URL, i.e., http://www.example.com/admin, for accessing directly admin login page or I can also use the URL http://www.example.com where login link is present on front-end header to navigate to the admin section.

First you need to go through https://www.roytuts.com/how-to-remove-index-php-from-url-in-codeigniter/, https://www.roytuts.com/setup-hmvc-with-codeigniter-2-1-4/ and https://www.roytuts.com/using-template-in-codeigniter/ tutorials for getting an idea for better understanding of the following implementation.
Continue reading “Separating Front-end and Back-end in Codeigniter”

Using Template in Codeigniter

This tutorial will show you an example on how to use template in Codeigniter. In an web application a template is recommended because there are certain regions or areas which are common to all pages and only the body portion of the page gets changed. Common areas like header, footer, left sidebar or right sidebar are mainly common areas for most of the web applications. So we will fix those common areas in the template file so that every page will use those common areas in the application and body portion of each page will contain content which is specific to the page.

We will use here Colin Williams template library to demonstrate the template system in Codeigniter. Now we will see step by step process how can we use the template library in Codeigniter application.

If you want to use Template library with Codeigniter 3 then you can read Using Template in Codeigniter 3

Continue reading “Using Template in Codeigniter”