Welcome Guest, Not a member yet? Register   Sign In
can't get link to work
#18

(This post was last modified: 03-25-2016, 11:37 AM by richie41.)

(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
Reply


Messages In This Thread
can't get link to work - by richie41 - 03-24-2016, 08:54 AM
RE: can't get link to work - by Paradinight - 03-24-2016, 12:26 PM
RE: can't get link to work - by richie41 - 03-24-2016, 02:59 PM
RE: can't get link to work - by twpmarketing - 03-24-2016, 02:30 PM
RE: can't get link to work - by richie41 - 03-24-2016, 02:48 PM
RE: can't get link to work - by pdthinh - 03-24-2016, 07:01 PM
RE: can't get link to work - by richie41 - 03-25-2016, 02:43 AM
RE: can't get link to work - by richie41 - 03-24-2016, 02:51 PM
RE: can't get link to work - by Wouter60 - 03-25-2016, 02:54 AM
RE: can't get link to work - by richie41 - 03-25-2016, 03:05 AM
RE: can't get link to work - by Avenirer - 03-25-2016, 03:21 AM
RE: can't get link to work - by richie41 - 03-25-2016, 03:22 AM
RE: can't get link to work - by Wouter60 - 03-25-2016, 03:23 AM
RE: can't get link to work - by richie41 - 03-25-2016, 03:41 AM
RE: can't get link to work - by pdthinh - 03-25-2016, 05:46 AM
RE: can't get link to work - by richie41 - 03-25-2016, 11:24 AM
RE: can't get link to work - by InsiteFX - 03-25-2016, 03:54 AM
RE: can't get link to work - by richie41 - 03-25-2016, 04:03 AM
RE: can't get link to work - by InsiteFX - 03-25-2016, 12:59 PM
RE: can't get link to work - by richie41 - 03-25-2016, 01:41 PM
RE: can't get link to work - by Wouter60 - 03-26-2016, 01:20 AM
RE: can't get link to work - by richie41 - 03-26-2016, 03:17 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 03:43 AM
RE: can't get link to work - by richie41 - 03-26-2016, 03:55 AM
RE: can't get link to work - by InsiteFX - 03-26-2016, 03:33 AM
RE: can't get link to work - by richie41 - 03-26-2016, 03:37 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 04:51 AM
RE: can't get link to work - by richie41 - 03-26-2016, 04:55 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 06:02 AM
RE: can't get link to work - by richie41 - 03-26-2016, 06:21 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 08:01 AM
RE: can't get link to work - by richie41 - 03-26-2016, 08:09 AM
RE: can't get link to work - by veronvynguyen - 03-12-2017, 01:57 PM
RE: can't get link to work - by kieranfitz - 04-21-2018, 04:40 PM
RE: can't get link to work - by InsiteFX - 04-22-2018, 04:27 AM
RE: can't get link to work - by InsiteFX - 04-22-2018, 04:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB