CodeIgniter Forums
How to use codeignitor, i am a new bie for the codeignitor - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: How to use codeignitor, i am a new bie for the codeignitor (/thread-21534.html)



How to use codeignitor, i am a new bie for the codeignitor - El Forum - 08-12-2009

[eluser]fariad22[/eluser]
I am new to codeignitor but a great wish to use it. I have made this code as my first program of codeignitor:
<?php
class HelloWorld extends Controller {
//intializer function
function HelloWord ()
{
parent:Controller();
}

function index()
{
$data['title'] = "My first application created with Code Ignitor";
$data['message'] = "Hello World!!!";

//load this to view
$this->load->view('helloworld', $data);
}

}
?>
I saved this file in "application/view" folder but i don't know how to keep this code in one file or have to made separate file for html to show data on visitors browser

Welcome for complete lesson... for the begning...


How to use codeignitor, i am a new bie for the codeignitor - El Forum - 08-12-2009

[eluser]Dam1an[/eluser]
Hi, welcome to CodeIgniter
What you have here, is a controller, so it should go in "application/controllers" and call it "helloworld.php".
You then need a seperate view file, which in this case will be called helloworld.php (as tats what you specify with the load->view function) which will go in application/views). The view file will now have access to the variables $title and $message, so you can output these in there.

I'd suggest if you've not already done so, read through the user guide start to finish, it will give you a great understanding of alll the basics Smile


How to use codeignitor, i am a new bie for the codeignitor - El Forum - 08-12-2009

[eluser]Johan André[/eluser]
The controller needs to go in application/controllers and the view in application/views.
Check out the userguide and the screencast on codeigniter.com, it really explains it all...

Good luck!
Johan


How to use codeignitor, i am a new bie for the codeignitor - El Forum - 08-12-2009

[eluser]fariad22[/eluser]
Thanks a lot i will be with you time by time...