CodeIgniter Forums
controller methods and manatory arguments - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: controller methods and manatory arguments (/showthread.php?tid=28776)



controller methods and manatory arguments - El Forum - 03-21-2010

[eluser]stoefln[/eluser]
hi there!

after quite a break i m back to codeigniter dev...

now i found a problem in my old app:


i have a controller method:
Code:
class Clipr extends MY_Controller{
  public function tag($tag){
...

when i call this method in the browser like that

http://localhost:8081/clipr/tag/
instead of
http://localhost:8081/clipr/tag/someTagValue

i get following error messages displayed:

Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined variable: tag
Filename: controllers/clipr.php
Line Number: 80

could anyone explain to me how to display the 404 page instead?

BR Stephan


controller methods and manatory arguments - El Forum - 03-22-2010

[eluser]stoefln[/eluser]
anyone?


controller methods and manatory arguments - El Forum - 03-22-2010

[eluser]flaky[/eluser]
change it to this
Code:
class Clipr extends MY_Controller{
  public function tag($tag=null){
      if($tag == null)
      //redirect or load the view containing 404 page
  }