Fresh Start with CodeIgniter

After giving up on learning MVC from a book about PHP I decided to learn/use CodeIgniter.

horizontal line celtic gif

Sources of Information

horizontal line celtic gif

 

ci_logo_flame

It’s better to start learning CI by reading its User Guide (instead of a book) since its examples will actually work—because they were written for the installed version of CI.

Here is a link to the User Guide for the current version (was Version 2.1.0 the 1st time I wrote this post—but this link will point to the current online UG) of CI: CodeIgniter Users Guide. There is a local copy—which is part of the install at:

http://sameh-labibs-imac.local/CodeIgniter_2.1.0/user_guide/

If I upgrade CI this URL may or may not change.

horizontal line celtic gif

The Install

horizontal line celtic gif

Download

Downloade file: CodeIgniter_2.1.0.zip

I un-zipped this file into my Mac’s samehlabib Sites directory. This Sites directory is the web-root for my Apache. The correlating URL for the latter is:

http://sameh-labibs-imac.local/

Cross Reference:
Moving my Mac OS X Sites Directory to Dropbox
and
Configure My Systems

Since the CI application has its index.php at the top directory of the install—and, since I didn’t strip away the top directory—the URL for my installation is:

http://sameh-labibs-imac.local/CodeIgniter_2.1.0/

Although index.php for the main CI app is here the rest of the code for my application (the code I create and modify) goes in directories two levels lower. The code will be in files found in sub-directories of http://sameh-labibs-imac.local/CodeIgniter_2.1.0/application/.

Configure

I made a change in the file config.php:

/application/config/config.php

I specified the base URL as follows:

$config['base_url'] = 'http://sameh-labibs-imac.local/CodeIgniter_2.1.0/';

Also, the manual says:

If you intend to use encryption or sessions, set your encryption key.

I intend to use sessions—and possibly encryption; However, I’ll wait on setting the encryption key.

Also, the manual says:

If you intend to use a database, open the application/config/database.php file with a text editor and set your database settings.

So, I took care of this using the database settings which I have documented elsewhere. However, I wasn’t sure about two of the settings. Here is how I filled the latter out:

$db['default']['database'] = 'samehrlabib_aTestMyLAMP';
$db['default']['dbprefix'] = '';

Maybe I should of had them as:

$db['default']['database'] = 'aTestMyLAMP';
$db['default']['dbprefix'] = 'samehrlabib_';

Either way I don’t think it makes a difference in my current situation.

Test

When I load the CI app URL I see a welcome page which tells me the page is being generated dynamically by CodeIgniter; and, if I would like to edit this page I’ll do that at:

application/views/welcome_message.php

or, the corresponding controller at:

application/controllers/welcome.php

horizontal line celtic gif

Advertisements

About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in CodeIgniter, Configure My Systems. Bookmark the permalink.

One Response to Fresh Start with CodeIgniter

  1. Pingback: CI Basics Tutorial (Controllers, Views and Routing) | Sam's PHP How-To

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s