site_url() and base_url(), both are useful functions in CodeIgniter. However, developers get confused about what is the difference between them and when to use site_url() or base_url(). In this article, we’re explaining both and use scenarios.
Category » CodeIgniter
Social Login – All in One with Hybridauth 3 and CodeIgniter
Hybridauth is a quite popular library to integrate Social Login in PHP based applications including CodeIgniter. You can add the login/register feature from almost all social providers like Google, Facebook using it. Hybridauth 3 has a lot of improvements to integrate social Sign In/Up in PHP websites.
Using CodeIgniter Transactions to Insert Records in Multiple Tables
There are times when you want to insert records in multiple tables. At the same time, you also want to ensure consistency. CodeIgniter simplifies MySQL transactions to perform Database operations on either all or none basis.
Live Server Transfer of a CI Project from Localhost – The Efficient Way
CodeIgniter offers an easy mechanism to maintain parameters for development and production environments. It simplifies the process of live server transfer of the CI project. In this article, we’re explaining you the efficient way CodeIgniter offers to easier the live server transfer process and making the site production ready with minor changes.
3 Ways – Insert Record in Codeigniter If not exists Else Update
There’re 3 ways to insert record in Codeigniter if it doesn’t exist else update the record if it exists. Here we’re using Active Record as well as Query Binding features in Codeigniter to insert or update a record.
2 ways to fix: Can’t use method return value in write context
Have you ever used a function call in `empty()` for an `if` condition to perform some checking? Then you might come up with an PHP fatal error saying Can’t use method return value in write context. I am explaining here why did the error come and 2 ways to write them correctly.
No input file specified. Codeigniter & htaccess
I have few sites of clients running with Codeigniter and are hosted by different hosts including Godaddy, Host Gator and others. With few hosts I had problems with working of CI, whenever I tried to access the website, I just used to get a text in browser saying ‘No input file specified’ and no html as expected except this text.
Organizing Codeigniter Controllers into Sub-Directories or Subfolders
While developing large applications, we might wish to organize Controllers into Sub-Directories or Subfolders for our convenient. This article will guide you to smoothly organize the controllers in sub-directory or folder. I’m using Codeigniter version 3.0 here.
Undefined property $db in Codeigniter
Are you facing any notice saying Undefined property: Home::$db or something like this in your Codeigniter application? The reason behind the error Undefined property $db in Codeigniter arises because you didn’t load database library in your controller/method to use any function of it.
Multiple forms on one page / controller and form validation
Sometimes it’s required to place two forms on one page in codeigniter like displaying login form and register form on same page. Although the views may be different but you can face conflict while displaying validation errors if the form actions are not separate (aren’t calling different methods in controller). Here is a workaround to validate one form at a time while placing multiple forms on one page in codeigniter.