CONTACT @ Skype : rajdimdung   |   call : +977 9841813550

How to create Static pages in CI Framework

Post by : Raj Dimdung    Date : 2015-02-02 03:19:54

Note: This tutorial assumes you've downloaded CodeIgniter and installed the framework in your development environment.

The first thing you're going to do is set up a controller to handle static pages. A controller is simply a class that helps delegate work. It is the glue of your web application.

For example, when a call is made to:

We might imagine that there is a controller named "news". The method being called on news would be "latest". The news method's job could be to grab 10 news items, and render them on the page. Very often in MVC, you'll see URL patterns that

Read More

How to implement file uploading class in CI Framework

Post by : Raj Dimdung    Date : 2015-01-10 06:39:50

CodeIgniter's File Uploading Class permits files to be uploaded. You can set various preferences, restricting the type and size of the files.

The Process

Uploading a file involves the following general process:

  • An upload form is displayed, allowing a user to select a file and upload it.
  • When the form is submitted, the file is uploaded to the destination you specify.
  • Along the way, the file is validated to make sure it is allowed to be uploaded based on the preferences you set.
  • Once uploaded, the user will be shown a success message.
  • To demonstrate this process here is brief tutorial. Afterward you'

    Read More

How to implement Security Class in CI Framework

Post by : Raj Dimdung    Date : 2014-12-29 11:33:50

The Security Class contains methods that help you create a secure application, processing input data for security.

XSS Filtering

CodeIgniter comes with a Cross Site Scripting Hack prevention filter which can either run automatically to filter all POST and COOKIE data that is encountered, or you can run it on a per item basis. By default it does not run globally since it requires a bit of processing overhead, and since you may not need it in all cases.

The XSS filter looks for commonly used techniques to trigger Javascript or other types of code that attempt to hijack cookies or do other malicious things. If anything disallowed is encountered it is rendered safe b

Read More

Managing URLs in CodeIgniter Framework

Post by : Raj Dimdung    Date : 2014-12-27 08:56:28

CodeIgniter URLs

By default, URLs in CodeIgniter are designed to be search-engine and human friendly. Rather than using the standard "query string" approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a segment-based approach:
Note: Query string URLs can be optionally enabled, as described below.

URI Segments

The segments in the URL, in following with the Model-View-Controller approach, usually represent:
  • The first segment represents the controller class that should be invoked.
  • The s

    Read More

Unit Testing Class in CI Framework

Post by : Raj Dimdung    Date : 2014-12-26 10:20:54

Unit Testing Class

Unit testing is an approach to software development in which tests are written for each function in your application. If you are not familiar with the concept you might do a little googling on the subject.

CodeIgniter's Unit Test class is quite simple, consisting of an evaluation function and two result functions. It's not intended to be a full-blown test suite but rather a simple mechanism to evaluate your code to determine if it is producing the correct data type and result.

Initializing the Class

Like most other classes in CodeIgniter, the Unit Test class is initialized in your controller using the $this->load->

Read More