Guys I'm a newbie to code igniter.. I do not understanding how to use this framework. Its just opening the user guide. Can anyone tell me the steps I need to follow to execute the "hello world" program on code igniter?
Make a file called hello.php
in your system/application/controllers folder. In the file, put this code:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
}
?>
Then go to http://localhost/codeigniter/index.php/hello
, and you should see the hello world. (You might've put it in a different directory than codeigniter, so change the url as needed).
Then you can change the code to:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
function test()
{
echo 'Second hello world!';
}
}
?>
and going to http://localhost/codeigniter/index.php/hello/test
would run the 'test' function from the class.
Using .htaccess and mod_rewrite you can remove the 'index.php' from your url, so you would only visit http://localhost/codeigniter/hello
or http://localhost/codeigniter/hello/test
.
Dont mistake code igniter with an IDE.
code igniter is a frame work, not an itegrated development enviroment (IDE). An example of an IDE is ECLIPSe. An IDE will have a text editor, mabee some syntax highlighting/bug checking/and even compiling capabilities..
A frame work on the otherhand is a set of functions/classes/scripts that contains code that you can reuse to make your life simpler, or to give it order.
So assuming you have downloaded code igniter and have it on your webserver, you can use the previous users instructions.
My advice is to watch/listen to the video tutorials avaliable here: http://codeigniter.com/tutorials/ and http://video.derekallard.com/ and make notes on them. Should show you how codeigniter works.