Welcome Guest, Not a member yet? Register   Sign In
how create an self installing project
#3

(11-23-2019, 09:00 AM)mewein Wrote: You should check the documentation of codeigniter for help but just to give you a quick start ill explain how to create your first codeigniter project.
Installation
1 Download the codeigniter framework
2 upload it in root directory of your website or local apache server directory.
Creating your codeigniter project. In codeigniter your controller will handle the url requests and load appropriate model and views. So the first step is to create your controller.

1 Creating your controller: go to Applications->controllers and there you will find a built in controller called welcome.php. This controller loads a view welcome_message.php which is inside Application->views. You can use this controller or create your own. To create your own controller create a new php file myfirstcontroller.php and extend a class with same name from CI_Controller. Note that the name of the file and your class name should be the same. the index function is the default function that will be called when you make a request to the controller
class myfirstcontroller extends CI_Controller {

    public function index(){

    $this->load->view("myfirstview");

    }

}
so when you request this controller through yoursite/index.php/myfirstcontroller

it will load a view called myfirstview.php which will reside inside applications->views.

Go ahead and create this file in applications ->views.

2 To pass data from controller to view you will send an array to the view
class myfirstcontroller extends CI_Controller {

    public function index(){

    $data['name']="My first application.";
    $this->load->view("myfirstview",$data);

    }

}
3 You can access this variable in view
  echo $name
and it will output your variable

3 you use models you have to create a file inside applications->models and call it from controller and it will return the result in the form of array.

You can look at the documentation for further help.

Hope this helped you to get started with codeigniter.

The user guide is inside your download library.
Good luck!!!

You dont understand me , i use codeigniter for my project ...

I can create an entire db by visit a page ,but  the answer is how can i set the db credential automatically in config->database or how can i semplify this process for user ? If i want create a csm how can user simply insert base_url and db credential without insert they in  config (in config  and database) ?
Reply


Messages In This Thread
RE: how create an self installing project - by pippuccio76 - 01-19-2020, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB