Questions tagged [codeigniter]

CodeIgniter is an Application Development Framework - a toolkit - for people who build websites using PHP. Created by EllisLab & fostered by BCIT it is now a project of the CodeIgniter Foundation. The framework implements a modified version of the Model-View-Controller design pattern. Use this tag for questions about CodeIgniter classes, methods, functions, syntax, and use. There are two major versions: 3.x and 4.x, addressing different system requirements

CodeIgniter is an web application framework created by EllisLab Inc, and it is now a project of British Columbia Institute of Technology. The framework implements a modified version of the Model-View-Controller design pattern. It is praised for its performance and the quality of its documentation. It's currently licensed under the MIT License, although the previous version was released under the Open Software License ("OSL") v. 3.0.

CodeIgniter is an open-source rapid development web application framework for building dynamic websites with PHP. "Its goal is to enable [developers] to develop projects much faster than writing code from scratch by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries." The first public version of CodeIgniter was released on February 28, 2006, and the latest stable version 4.2.10 was released on November 5, 2022

CodeIgniter is loosely based on the popular Model-View-Controller development pattern. While view and controller classes are a necessary part of development under CodeIgniter, models are optional.

With more than 18.2k stars on Codeigniter's repository, it's also among the most starred PHP Framework on Github.com

These are generally regarded as pros of the framework:

  • Nearly zero configuration & No restrictive coding rules
  • Small footprint
  • Performance
  • Easy to learn
  • Great documentation
  • No restrictive coding rules

These are generally regarded as cons of the framework:

  • No built-in ORM
  • No built-in templating
  • Doesn't utilize namespaces
  • Doesn't utilize PHP's auto-loading feature
  • Application code is tightly-coupled with the framework

CodeIgniter Versions

Current Stable Version: 4.2.10 (Release Date: November 5, 2022)


Top Tips For Codeigniter

One of the most commonly asked questions in Codeigniter on Stack Overflow is when I view my page and get the error 404 "Page Not Found". It would help if you looked at a couple of solutions before asking the question.

  1. Solution 1: Check the first letter of the class name and filename of the controller and models in the Uppercase example: Welcome.php

  2. Solution 2: If base_url() returns unexpected results, it's because you have not set a $config['base_url'] value.

  3. Solution 3: If you have not configured your CodeIgniter application/config/config.php file to remove $config['index_page'] = ''; then you will need to include the index.php in your URL

  4. Solution 4: After all settings, you need to load the form URL etc.. in autoload.php $autoload['helper'] = array('url', 'file', 'form', 'security');

    http://www.example.com/index.php/site
    

Note you will need a .htaccess file when you are removing index.php .htaccess for Codeigniter 2 & 3


Frequently asked questions


Online resources

69561 questions
6
votes
2 answers

Trying to get property of non-object? PHP/Codeigniter

I have been literally pulling my hair out with this one and its beginning to delay the rest of my project and it really is getting me down. I am trying to populate a pull down using values taken from a database table so that if in the future the…
sqlmole
  • 997
  • 7
  • 17
  • 31
6
votes
4 answers

CodeIgniter: Class 'CI_Controller' not found

I've extended CodeIgniter controller by adding MY_Controller.php in Application/Core folder. It works fine, but Now when I add following code on error_404.php page in Application/errors, I get error. Code causing problem:
Roman
  • 3,764
  • 21
  • 52
  • 71
6
votes
7 answers

Javascript confirm delete

Am creating a simple cms and i have the following
MrFoh
  • 2,693
  • 9
  • 42
  • 77
6
votes
11 answers

CodeIgniter - Blank page on database autoload

I encouter a problem since this morning, after I migrated my website from my local machine to the server. To replace the context, I developed a website with the framework CodeIgniter, and everything before the migration was working fine. After a…
BMN
  • 8,253
  • 14
  • 48
  • 80
6
votes
1 answer

Codeigniter MYSQL data minus date1 data from date2

This is my Codeigniter project, I've made a bookshop function that counts the amount of brought and sold for the book in each entry and minus the sold price and gives me the amount that I currently have for each book. Type "0" = The amount that I…
Numlet
  • 819
  • 1
  • 9
  • 21
6
votes
1 answer

Codeigniter add multiple category to a course (Academy-LMS)

I am using Academy LMS Source code is in Github it's a Learning Management system and it is designed to have one category per course I want to add multiple categories to one course In /controllers/API.php I have // Fetch all the categories …
CatChMeIfUCan
  • 569
  • 1
  • 7
  • 26
6
votes
1 answer

Including Pear Libraries in PHP Frameworks

How should PEAR libraries be incorporated as packages / libraries within PHP frameworks? Namely, I'm using a package system within a PHP framework - and need those PEAR libraries to be easily redistributable (I'm referring specifically to…
Calvin Froedge
  • 16,135
  • 16
  • 55
  • 61
6
votes
4 answers

using a base64 encoded string in url with codeigniter

I have an encrypted, base64 encoded array that I need to put into a url and insert into emails we send to clients to enable them to be identified (uniquely) - the problem is that base64_encode() often appends an = symbol or two after it's string of…
John Hunt
  • 4,265
  • 8
  • 45
  • 59
6
votes
2 answers

Setting Up Emails in Code Igniter 2.02

I’m getting a lot of errors. And I've tried several suggestion across different sites, deleted the parent function, removed the array, updated my php ini file, no luck. This is the first of 13 errors I’m getting. A PHP Error was…
Mayowa
  • 143
  • 2
  • 11
6
votes
4 answers

Https causing redirect loop?

I am using code igniter, our server is behind some funky config. I want certian pages to be behind https, certian pages to be behind http, and others I don't care about. So below is my setup, If I go to http://test.example.com (which has a call to…
Hailwood
  • 89,623
  • 107
  • 270
  • 423
6
votes
3 answers

Options for client side zip file extraction before upload

Our problem We are building a browser based application that allows a user to upload files to a server for processing. The server side is written in PHP using the Codeigniter v2.0.2 framework. The files to be uploaded are the output of another…
Toenex
  • 223
  • 1
  • 10
6
votes
1 answer

PyroCMS: how to share resources between modules?

I'm new to PyroCMS and struggling to get help on the forums (slow responses, minimal activity, etc.). So, I'm hoping someone here on SO can help. How do I share resources (e.g. models, controllers, views, etc.) between modules? It seems that every…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
6
votes
1 answer

adding attributes to form_open_multipart

I was wondering how could we add attributes to file_upload in codeigniter right now I am using form_open_multipart('controller'); but I want to add an id attribute to it. Any help appreciated thanks!
koool
  • 15,157
  • 11
  • 45
  • 60
6
votes
3 answers

Codeigniter do_upload() silently fails on "success"

I'm using CodeIgniter to write an image upload form. I've previously got similar code to work for a different site. At the moment - the code for receiving a multipart/form-data image is failing silently. While configuring the server/script I…
John Beech
  • 61
  • 1
  • 2
6
votes
6 answers

Using Ion Auth as a separate module in the HMVC structure

I am interested in using ion auth for a project of mine which is running on the HMVC pattern. The application is written in Codeigniter. The problem I face is once the ion auth is placed in the /app/modules/auth folder, when I try to access the…
Gayan Hewa
  • 2,277
  • 4
  • 22
  • 41