(03-25-2016, 05:46 AM)pdthinh Wrote: (03-25-2016, 03:23 AM)Wouter60 Wrote: Please try this:
PHP Code:
public function details($id)
{
//Get Product Details
$data['product'] = $this->product_model->get_product_details($id);
echo '<pre>';
print_r($data);
echo '</pre>';
//Load View
$data['main_content'] = 'details';
//$this->load->view('layouts/main', $data);
}
This should output the contents of your $data array, including the object or array that was returnd by your model.
@richie41: What output you get when run above function?
PHP Code:
class Products extends CI_Controller{
public function details($id){
//Get Product Details
$data['product'] = $this->Product_model->get_product_details($id);
//Load View
$data['main_content'] = 'details';
$this->load->view('layouts/main', $data);
}
}
Sure I've tried that. I just commented out the get all products in the Products.php in the CONTROLLERS folder. So it just left the get product.
PHP Code:
$route['default_controller'] = 'products/details';
Changed the routes.php to 'products/details'.
Took out all the php from details.php file in the VIEWS folder. And the details page loads.
So the routes.php needs to be configured to show the get all products when the url is localhost/thegamingplace then when I click on one of the products the url should be localhost/thegamingpace/products/details/(whatever the id is) and should display the single product details.php page