Welcome Guest, Not a member yet? Register   Sign In
URI Routing Help
#1

[eluser]beerguide_au[/eluser]
I am currently working on an application which has the following requirements:

URI must be in the format /product-reviews/company-name/product-name (or if a direct review id is known) /product-reviews/company-name/product-name/review-id

I wrote the following route in route.php (config)
$route['product-reviews/:any/:any'] = 'productreviews/review_lookup/$1/$2';

Which as I understand will call the productreviews class, and then the review_lookup function and pass that function the parameters from the :any (ie: $1 and $2).

My problem is when echo'ing out the parameters on my view I simply get a "$1".

My controller code is:
Code:
function review_lookup( $company_name, $product_name ) {
        // $this->load->view('productreviews_view', $data );
        $data['company_name'] = $this->uri->rsegment(3);
        $data['product_name'] = $this->uri->rsegment(4);
        
        $this->load->view('productreviews_view', $data );
    }

My view code is simply:
Code:
<?php
echo $product_name;
?>

Im assuming my controller and views are all hooked up correctly as its loading the correct function and view, just displaying the wrong data.

Is it my routing rules that are wrong, or the way I'm calling it/them from the controller?

Thanks in advance for anyone that can help.


Messages In This Thread
URI Routing Help - by El Forum - 02-12-2008, 05:50 PM
URI Routing Help - by El Forum - 02-12-2008, 06:50 PM
URI Routing Help - by El Forum - 02-12-2008, 07:07 PM
URI Routing Help - by El Forum - 02-12-2008, 07:32 PM
URI Routing Help - by El Forum - 02-12-2008, 08:56 PM
URI Routing Help - by El Forum - 02-13-2008, 12:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB