CodeIgniter Forums

Full Version: How to use codeignitor, i am a new bie for the codeignitor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I am new to codeignitor but a great wish to use it. I have made this code as my first program of codeignitor:
class HelloWorld extends Controller {
//intializer function
function HelloWord ()

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

El Forum

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

El Forum

[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, it really explains it all...

Good luck!

El Forum

Thanks a lot i will be with you time by time...