Skip to main content

Posts

how to deal with database in codeigniter

codeignitor Here's an (obviously contrived) example: model: class Model extends CI_Model {     public function get_data()     {         return $this->db->query('your query');     } } controller: class Controller extends CI_Controller {     public function index()     {         $data['query_result'] = $this->model->get_data();         $this->load->view('index', $data);     } } view: <div> foreach($query_result->result_array() as $row){     $row['key'];  }     </div>
Recent posts

Creating a modal window with HTML5 & CSS3

Modal boxes are a frequently utilized tool in the web developer’s arsenal. Used for, amongst many things, login/register forms; advertisements; or just notifications to the user. However despite the fact that modal windows frequently contain mission critical information, they are routinely created with JavaScript, which does not sit well with the best-practices of progressive enhancement or graceful degration. This doesn’t need to be a problem, because HTML5 & CSS3 allow us to create modal windows with ease.  The HTML The first step to creating our modal box is this short but sweet markup:  < a href = "#openModal" > Open Modal </ a > < div id = "openModal" class = "modalDialog" > </ div > As you can see, we just have a simple link that says “Open Modal” and links to our openModal div that is placed right below it. We are doing all of our styling here with classes, so we use the ID just as a hook for openi...

How to setup CodeIgniter in your localhost with WAMP server

I've been developing a couple of website using codeIgniter framework. I only learned about this framework early this year 2011. Basically, I've tried installing codeIgniter from localhost and on the host server itself. How to make codeigniter work is very simple and easy. Below are the steps to kick start your first website using codeigniter. 1. Installing WAMP First and foremost, before you can have your website running on your localhost you should get a copy of WAMP(Windows Apache MySQL and PHP). It is where you can manage your server settings and Apache/MySQL services. So start downloading Wampserver now! As you can see there are 2 buttons to download between 32bits and 64bits that would be basing on your system type. To check what OS type is running click Windows logo on your keyboard + Pause/Break and a window will appear. After download, double click the file and follow the instructions given. Everything will be installed automatically  with the ...

CodeIgniter: Understanding the Basics with a VPS

CodeIgniter: Getting Started With a Simple Example Introduction CodeIgniter is a lean PHP web application framework that is very powerful yet easy to use. It provides a set of libraries and helper functions to allow people to develop their applications much faster. For this, it uses Object Oriented Programming (OOP) techniques and a Model-View-Controller (MVC) approach for a nice separation of presentation from logic. In addition, CodeIgniter uses Clean URLs to avoid those ugly query string filled URLs that nobody likes. This article assumes you have already installed CodeIgniter on your development environment and did the initial database and URL configurations. You can consult this tutorial for more information about quickly getting you set up. Model-View-Controller (MVC) Approach The MVC programming approach is meant to separate presentation from logic. This means that you can have web pages without much PHP scripting as this is kept separate in other file...

How To Install CodeIgniter on an Ubuntu 12.04 Cloud Server

CodeIgniter: Getting Started With a Simple Example About CodeIgniter CodeIgniter is an open source web application framework for PHP that is small in size but very powerful in utility. Its goal is to enable people to write their applications much faster than normal by providing a set of libraries and helpers for the most common tasks. It is based on the Model-View-Controller approach for a great separation of logic from presentation. This tutorial will show you how to setup CodeIgniter on your cloud server using the command line. It will also go through some of the initial configuration you are likely to want to make. This tutorial assumes that you are already running your own VPS with root access and have LAMP (Linux, Apache, MySQL and PHP) installed on it. You can consult this tutorial that will get you going with the latter if you haven't already. Installing CodeIgniter (CI) First, you need to navigate to your cloud server's directory root folder...

CodeIgniter: Getting Started With a Simple Example

CodeIgniter: Getting Started With a Simple Example Introduction CodeIgniter is a powerful PHP framework that can help you greatly speed up the development of your web applications. It is has a small performance footprint due to the modular approach to loading its libraries and does a great job separating logic from presentation by using a Model-View-Controller (MVC) dynamic. In this tutorial, you will learn how to create a very simple application that displays content from the database. It is not meant to provide the solution to building your own CMS, but rather to illustrate how CodeIgniter can be used. Additionally, it seeks to put in practice some of the lessons learned in the previous article and assumes you already have CodeIgniter installed on your development environment and have configured it as described in the first tutorial. The Plan In this article, you will see how to use some of CodeIgniter’s classes and functions to query a database table c...

Basic naming idea in codeigniter

File Naming Class files must be named in a Ucfirst-like manner, while any other file name (configurations, views, generic scripts, etc.) should be in all lowercase. INCORRECT: somelibrary.php someLibrary.php SOMELIBRARY.php Some_Library.php Application_config.php Application_Config.php applicationConfig.php CORRECT : Somelibrary.php Some_library.php applicationconfig.php application_config.php Furthermore, class file names should match the name of the class itself. For example, if you have a class named  Myclass , then its filename must be Myclass.php. Class and Method Naming Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. INCORRECT : class superclass class SuperClass CORRECT : class Super_class class Super_class {           public function __construct ()        ...