Apply for Zend Framework Certification Training

Codeigniter




After Creating Project Setup 
we will see How value will be passed from Controller to view 

user.php  //Controller
----------
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class User extends CI_Controller 
{
    public function index(){
       $data['first_name'] = "Rajesh";
       $data['address'] = "Faridabad";
       $data['qualification'] = "MCA";

       $this->load->view('user/user_about'',$data);
    }

}
-----------Here we can see that $data is an array 
in which we have assigned Three Values and later on 
we have assigned array data  to view
In view folder 
application
   -- view
     --user
          --user_about.php


In user_about.php 
  you need to write the code to retrieve data

<?php 
        echo "Name - ".$first_name;
        echo "Address - ".$address;
        echo "Qualification - ".$qualification;

?>



                                    

< How to setup a 404 page in CodeIgniter website Last >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top