Why do I pass a variable name when calling a view file?
For example: $this->load->view("{$viewData->viewFolder}/{$viewData->subViewFolder}/index", $viewData);
Why we writing $viewData at a last code line?
Why do I pass a variable name when calling a view file?
For example: $this->load->view("{$viewData->viewFolder}/{$viewData->subViewFolder}/index", $viewData);
Why we writing $viewData at a last code line?
no need to load variable:
$data['view'] = 'folername/view_file_namae';
$this->load->view('you can call common file for header/footer here', $data);
To pass a variable name to view file,
$this->data['anyname'] = $variable;
$this->load->view('viewfilename',$this->data);
and In your view file name, access your passed data as echo $anyname;
.
You can pass a variable or an array as you want.
If you want to append a variable name to a view file, you can use redirect() function.
Source : https://www.codeigniter.com/user_guide/helpers/url_helper.html#redirect
e.g.
redirect('home/category/'.$variable, 'refresh');
redirect('home/category/subcategory/'.$variable, 'refresh');