[eluser]skunkio[/eluser]
Hi all,
there is something I'm not getting about use route to call a method passing three values.
I have a controller with the following method inside
Code:
public function view_day($year, $month, $day)
{
$data['year'] = $year;
$data['month'] = $month;
$data['day'] = $day;
$this->load->view('calendar/view_day', $data);
}
and a page within my views folder with the follows
Code:
<?
echo $this->uri->segment(5).'<p>';
echo $day;
?>
finally, within my routes file I have the line below
Code:
$route['calendar/date/:num/:num/:num'] = "calendar/view_day/$1/$2/$3";
What I supposed to do is route an url like
Code:
http://www.mydomain.com/index.php/calendar/date/2012/06/10
to my calendar controller passing three values (2012, 06 and 10) to my view_day method. Then, collect these three values and pass them to my final page in order to use $day, $month and $year inside my presentation page.
Now, running the url above the result is
10 (returned by the row -> echo $this->uri->segment(5).'<p>'

$3 (returned by the row -> echo $day
Basically, what I'm not getting is way the variable $day inside my presentation page is not getting any value as passed inside the url but returns the same text ($3) I have wrote in my route statement.
Thanks