Welcome Guest, Not a member yet? Register   Sign In
Public variable used in views can do or not?
#1

HAPPY NEW YEAR 2015

For User class as :-
PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
User extends MY_Controller 
{

 
  public $tableData;

 
  public function index()
 
  {
 
    ...
 
    $this->tableData  $this->table->generate(); 
 
    $this->load->view('user');
 
  }



For User view as:-
PHP Code:
...
<
div class="table-data">
<?
php echo $this->tableData?>
</div>
... 

for above example I have declare $tableData is public variable then in view <?php echo $this->tableData; ?> this is good or not ?
or I should pass data array via load view
Reply


Messages In This Thread
Public variable used in views can do or not? - by Wong - 01-01-2015, 01:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB