Reputation: 12163
I keep getting, an unable to load requested file error. Does anybody know how I can add a GET string to the view loader below?
if ($userType == 'regular') {
foreach ($query->result() as $row) {
$data = array('firstname' => $row->firstname);
$this->load->view('reg-user/dashboard.php?requestedPageType=wall_1', $data);
}
Upvotes: 0
Views: 441
Reputation: 75945
GET Strings are the ones following a question mark (query strings)
if you have
name=value
name2=value2
Just add it on to
$this->load->view('reg-user/dashboard.php?requestedPageType=wall_1&name=value&name2=value2');
So your statement would be
$this->load->view('reg-user/dashboard.php?requestedPageType=wall_1&name=value&firstname='.urlencode($row=>firstname));
I'm not sure about your loop but I presume you want each row to be encapsulated into a query string
so try this as your code if this is what you want to do:
if ($userType == 'regular') {
$data = array();
foreach ($query->result() as $row) {
array_push($data, $row);
}
$query_string = http_build_query($data);
$this->load->view('reg-user/dashboard.php?requestedPageType=wall_1&'.$query_string);
}
Upvotes: 0
Reputation: 303
Yo.
You cant pass a query string to a view. Your view files name must end in .php
Use the data array to pass your additional infos instead.
Upvotes: 2