O
O
OKNOZA2017-01-30 18:59:01
Kohana
OKNOZA, 2017-01-30 18:59:01

Kohana how to pull array from controller to View?

Controller

class Controller_Main extends Controller_Template {
  
  public $template = 'index';
  
  public function action_index(){
      
  $data = array ("name" => "вася", "age"=>"29", "title"=>"данные человека");
      
    	$this->template->content = View::factory('news',$data);		
  }
}

view
foreach ($data AS $key => $value) {
    echo "Вывести все данные";
}

But he already passes the variable not Data, but $name = Vasya, or how is everything done differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OKNOZA, 2017-01-30
@OKNOZA

The topic is closed everything is done with ->bind

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question