CodeIgniter Forums
routes bug ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: routes bug ? (/showthread.php?tid=7073)



routes bug ? - El Forum - 03-23-2008

[eluser]EugeneS[/eluser]
in routes.php i have:
Code:
$route['contacts'] = 'welcome/index/2';

then i go to the url like:
http://localhost/contacts

yes i'm in the class "welcome" method "index" but when i'm trying to access url segments it doesnt work:
Code:
echo $page_id = $this->uri->segment(1, 1);
result: contacts

echo $page_id = $this->uri->segment(2, 1);
result: 1

echo $page_id = $this->uri->segment(3, 1);
result: 1

i was thinking it should be
Code:
echo $page_id = $this->uri->segment(1, 1);
result: welcome

echo $page_id = $this->uri->segment(2, 1);
result: index

echo $page_id = $this->uri->segment(3, 1);
result: 2

my expectations are wrong or its bug ?


routes bug ? - El Forum - 03-23-2008

[eluser]frenzal[/eluser]
if you want the rerouted segments use uri->rsegment


routes bug ? - El Forum - 03-23-2008

[eluser]EugeneS[/eluser]
[quote author="frenzal" date="1206335661"]if you want the rerouted segments use uri->rsegment[/quote]


ouch ! Smile thanks ... its time to get some rest Smile