0

For simplicity, I would really like my URLs for adding and listing of items to look like:

inventory/list
inventory/new

Of course, list and new are reserved in PHP so I can't use them as CodeIgniter function names.

My workaround was to give my functions different names and then use routes in CI to redirect to the correct function.

My first thought was to add underscores so that list_ and add_ were the function names. Is there a better answer, or is this unsafe in some way that I am failing to see?

Steven Sokulski
  • 354
  • 1
  • 4
  • 17
  • 1
    Well in Symfony the conventions is `executeName` and in ZF its `nameAction` so either one of those are pretty straightforward, converting to `snake_case` for CI i suppose.... evil, evil, snake_case... – prodigitalson Feb 25 '13 at 18:32

1 Answers1

0

Use routes to map the urls to different function names internally. Check out CI's Routing Docs.

Jerry
  • 3,391
  • 1
  • 19
  • 28
  • Um, sorry, not sure how I didn't catch that you were already doing that. I think your solution id fine, but I'd use function names like `list_xyz` and `add_xyz` to be more explicit. – Jerry Feb 26 '13 at 01:03