Controller name "List" doesn't work; "List2" works fine. |
[eluser]itsdanieloconnor[/eluser]
Hey guys, So I was getting a blank page when trying to create a super-simple controller "list.php." Filename: list.php Code: <?php Filename: list2.php Code: <?php That one works. ¿Qué? I don't see "list" on the reserved list.
[eluser]JHackamack[/eluser]
List is a php function so you're probably running into conflicts there: http://php.net/manual/en/function.list.php when you define it with the parent::Controller();
[eluser]itsdanieloconnor[/eluser]
Yeah, that must be the problem. Is there anyway to use .htaccess to show "list" when the controller name is "lists"?
[eluser]Unknown[/eluser]
As JHackamack said, list is a reserved keyword in PHP (http://www.php.net/manual/en/reserved.keywords.php) so it's most likely why you're having the problem. The solution is to use codeigniter's URI routing (http://ellislab.com/codeigniter/user-gui...uting.html). URI Routing will allow you to define a relationship between a URI path like 'list' and your controller... You can even use wildcards and regular expressions. The route you'd want to define is really simple... just something like this: Code: $route['list'] = "lists"; where 'lists' is whatever you've used for your controller name
[eluser]itsdanieloconnor[/eluser]
Thanks! That fixes my problem. Maybe the Codeigniter team could add a mention of these reserved keywords on the CI reserved keywords page.
[eluser]danmontgomery[/eluser]
http://www.php.net/manual/en/reserved.keywords.php |
Welcome Guest, Not a member yet? Register Sign In |