Skip to main content

Posts

Showing posts from 2014

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 ()        ...

Codeigniter php frameworks: views part 3

codeIgniter Codeigniter php frameworks will be start to views part 3, if you haven’t read the , please read it before. In part 3, we will be teaching you about Storing Views within Sub-folders and Adding Dynamic Data to the view . Firstly is Storing Views within Sub-folders , your view files can also be stored within sub-folders if you prefer that type of organization. When doing so you will need to include the folder name loading the view, like this $this->load->view(' folder_name/file_name '); . Now let’s change our learning to Adding Dynamic Data to the View . Data is passed from the controller to the view by way of an array or an object in the second parameter of the view loading function. Codeigniter php frameworks have example using an array. So you can copy it to your controller file with your text editor. using array variables. using object variables. FYI, if you use an object, the class variables will be returned into array elements....

Codeigniter php frameworks: installation codeigniter part 1

codeIgniter Codeigniter php frameworks  is back. I think, I must show you how to install codeigniter in your server, Or you can see at user guide codeigniter. First, download the latest version codeigniter from codeigniter.com , the same steps as I told in previous post . After that unzip the package, and upload the codeigniter folders and files to your server. Normaly the index.php file will be at your root. After that open the application/config/config.php file with your own text editor and set your base URL. If you intend to use encryption or sessions, set your encryption key. Keep in mind that the steps described by Codigniter php frameworks is references from http://codeigniter.com/user_guide/ . In the first paragraph you know how to install it, in the second paragraph Codeigniter php frameworks will be show you how to set the base url to automatically, you just have to change this variable $config[‘base_url’] at config.php file into this text bellow: $conf...

Codeigniter php frameworks: codeigniter URLs part 2

codeIgniter Codeigniter php frameworks will be next to part two of codeigniter URLs. If you have not read the part one of codeigniter URLs, please follow this link to read it. Okay back to the lesson, now we talk about Adding a URL suffix. To active it you can find this configuration at config/config.php , you can specify that will be added to all URLs generated by codeigniter. for example, if the URL is example.com/index.php/products/view/shoes , you can optionally add a suffix, like .asp , making the page appear to be of a certain type like this example.com/index.php/products/view/shoes.asp . And the last lesson of codeigniter URLs is Enabling Query Strings, in some cases you might prefer to use query strings URLs like this index.php?c=products&m=view&id=345 . Codeigniter optionally supports this capability, which can be enabled in your application/config.php file. Codeigniter php frameworks will be show you the config file preview. The preview will be like th...

Codeigniter php frameworks: codeigniter URLs part 1

codeIgniter Codeigniter php frameworks will teach you about codeigniter URLs. If you not understand about installing codeigniter, please follow the previous post . The codeigniter URLs feature is designed to be search engine and human friendly. For the example is example.com/ news / article / my_article . Firstly is URI Segment, the segment in the URL is following with the Model-View-Controller(MVC). And for the structure  is example.com/ class / function / ID . Class is the first segment represents the controller class that should be invoke. Function is the second segment represents the class function, or method, that should be called. And ID is the third, and any additional segment, represents  the ID and any variables that will be passed to the controller. For the second learn about codeigniter URLs is How to removing the index.php. what is index.php? index.php is the main file to default appear to your URL. The actually codeigniter URL is example.com/ index....

Codeigniter php frameworks: controllers part 7

codeIgniter Codeigniter php frameworks , we will continue the next part or the last part of controllers, now is part number 7, didn’t read the part 6, please read these part first. In the part 7 we will learn about class constructors , if you intend to use a constructor in any of your controllers, you must place the following line of code like this parent::__construct(); .The reason this line is necessary is because your local constructor will be overriding the one in the parent controller class so we need to manually call it. <?php class Blog extends CI_Controller {        public function __construct() {              parent::__construct();             // Your own constructor code        } } ?> Constructors are useful if you need to set some default values, or run a default process w...

Codeigniter php frameworks: controllers part 6

Codeigniter php frameworks is back, now we going to learn controllers part 6, about private function and organizing your controllers into sub-folders . If you not have read the previous part , please read it before read this post. Okay about private function , in some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this. private function _utility() {   // some code } Trying to access it via the URL, like this example.com/index.php/blog/_utility/ will not work. Now Codeigniter php frameworks talk about organizing your controllers into sub-folders, if you are building a large application you might find it convenient to organize your controllers into sub-folders. Codeigniter permits you to do this. Simply create folders within your application/controllers directory and place your control...

Codeigniter php frameworks: controllers part 5

odeigniter php frameworks will be learn about processing output of controllers in the title of “Codeigniter php frameworks: controllers part 5”. I think you must follow previous part of controllers to know about codeigniter controllers. We have learn about controller in the part 1 , 2 , 3 , and 4 .  I suggest you to read these part before you read this part. Now let’s go to the lesson of part 5. Processing output , codeigniter has an output class that takes care of sending your final rendered data to the web browser automatically. More information on this can be found in the View and Output Class in the next lesson of Codeigniter php frameworks .   In some cases, however, you might want to post-process the finalized data in some way and send it to the browser yourself. Codeigniter permits you to add a function named _output() to your controller that will receive the finalized output data. For important information, if your controller contains a function named _out...

Codeigniter php frameworks: controllers part 4

Codeigniter php frameworks will be go to the part 4 of controllers. If you have not read the previous part . Now we learn about defining a default controller . Codeigniter can be told to load a default controller when a URI is not present, as will be the case when only your site root URL is requested. To specify a default controller, open your application/config/routes.php file and set this variable $route['default_controller'] = ' Blog '; . Where blog is the name of controller class you want to be use. If you now load your main index.php file without specifying any URI segments you’ll see your Hello World message by default. Codeigniter php frameworks is finish talking about default controller, now we going to remapping function calls . As defining a default controller, the second segment of the URI typically determines which function in the controller get called. Codeigniter permits you to override this behavior through the use of the   function like this. ...