Welcome Guest, Not a member yet? Register   Sign In
How to use codeignitor, i am a new bie for the codeignitor
#1

[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...
#2

[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
#3

[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
#4

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




Theme © iAndrew 2016 - Forum software by © MyBB