• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI Segment question

#1
[eluser]pmonty[/eluser]
I am running CI on a windows server box. I am using the ? syntax in my url's.
For example: mysite.com/index.php?/mytest

This works fine to call the controller which is shown below.
Code:
<?php
class Mytest extends Controller {
  function index()
  {
    if ($this->uri->segment(2) === FALSE) {
      $period = 1;
    } else {
      $period = $this->uri->segment(2);
    }
    echo $period;
  }
}
?>
However, this url mysite.com/index.php?/mytest/2 gives a page not found 404 error.
Shouldn't the mytest controller be called and processed? What am I missing?

Paul

#2
[eluser]Michael Wales[/eluser]
Yes, the mytest class is being called, but you are attempting to call a method named 2.

URLs are: domain.com/class/method/param1/param2/param3/etc/etc/etc

#3
[eluser]pmonty[/eluser]
That was it! Thanks so much.

Paul


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.