Archive for the ‘Uncategorized’ Category
Server recommendation for CodeIgniter applications
One of the most notorious benefit about using CodeIgniter is that CI applications usually runs without problems on any common Linux server as well as Windows servers supporting PHP. This is a strong benefit versus other PHP frameworks that require special server settings or configuration in order to work.
So, lot of server companies may be suitable for CodeIgniter applications, but here are some recommendations for Hosting providers that we were using to successfully run CodeIgniter applications.
Managed VPS
For Managed VPS services we have been using WiredTree.
They provide a reliable service with very fast support that makes this ideal for applications that must be up most of the time.
Shared Hosting
For Shared Hosting, we were using A2Hosting.
They provide a good relation cost/benefit for shared accounts and reseller accounts with different plans and packages that makes this suitable for general purpose applications or websites.
Codeigniter and Uploadify
Uploadify is a great jQuery library that you can use to support fancy uploads into your application. People may encounter a problem when using Uploadify in CodeIgniter.
If you get continuously errors while uploading from Uploadify to a CI controller, you can try to log the error messages to see if the error contains 'application/octet-stream'
In that case, please follow the instructions here.
…make sure you have added “application/octet-stream” to each filetype in your config/mimes.php file.
So, let’s say you are trying to support images and got application octet stream error, then you can try to edit the mimes.php in config folder to something like this:
'gif' => array('image/gif', 'application/octet-stream' ),
'jpeg' => array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),
'jpg' => array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),
'jpe' => array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),
'png' => array('image/png', 'image/x-png', 'application/octet-stream'),
CodeIgniter 1.7.2 released
The new CodeIgniter 1.7.2 release includes the following general changes:
- Compatibility for PHP 5.3.0
- The Form Helper class has been improved
- New simple Cart Class has been introduced (we commented something about it in an earlier post)
- A new function is_php() has been introduced
- Also, show_error() function allows to send HTTP responses.
This new release can be downloaded from here.
Get a single table field value from database using CodeIgniter
If you want to get a single value from a database table, then an easy way to achieve that in CodeIgniter could be:
$count = $this->db->query('SELECT count(*) as count FROM departments')->row()->count;
Replace department by your table name, and of course, replace count(*) as count by your desired field.
Using a super Controller class in CodeIgniter
CodeIgniter is easy to understand if you know how MVC design pattern works. Just need to define your model, your controller and your views.
However, sometimes you need to reuse code in all your site pages and probably you ask yourself “How do I do that?”.
Well, here is a simple tip that may help you to reuse generic data, fields, etc. in your CodeIgniter application.





