I am this close to give up on CI |
[eluser]KevinLG[/eluser]
CI could put this line in the first page of the manual: "If your hosting service does not support the PATH_INFO variable needed to serve search-engine friendly URLs, then for your mental health's sake you better not use Codeigniter." That would have saved me 4 miserable hours. OK, sorry. I have set up these: Code: $config['index_page'] = "index.php?"; My controller file is delme.php: Code: <?php This controller is placed in a subfolder 'test' of the 'controllers' folder. My question is what URL I should use to access this "greeting" method? The url "http://www.my-site.com/index.php?/test/c=delme&m=greeting&name=kevin×=5" just refused to work. I know why, because I made that sh*t up! And I tried numerous other wierd combinations. Where is the explanatin in the touted excellent manual about this? Thanks for your help. A newbie's frustration, forgive me please.
[eluser]xwero[/eluser]
There is a hosting service that doesn't support path_info ??? Even free hosters allow path_info. I even believe it's a part of the http protocol. The first mistake you made is the question mark for the index_page. If there is a querystring the question mark will be added automatic. The second mistake is not having a constructor in your controller Code: class Delme extends Controller { The third mistake is your url. I don't know how the querystring is if you put the controller in a subfolder but i guess the url would look more like http://www.my-site.com/index.php?c=test&...in×=5 Try the controller in the controller directory with the url http://www.my-site.com/index.php?c=delme...in×=5 This should work
[eluser]KevinLG[/eluser]
Hi Thanks for the help, but it's still not working. I followed your three suggesstions, also, I put the delme.php in the "controllers" folder. The error message when accessing http://www.my-site.com/index.php?c=delme...in×=5 is: A PHP Error was encountered Severity: Warning Message: Missing argument 1 for greeting() Filename: controllers/delme.php Line Number: 14 A PHP Error was encountered Severity: Warning Message: Missing argument 2 for greeting() Filename: controllers/delme.php Line Number: 14 A PHP Error was encountered Severity: Notice Message: Undefined variable: times Filename: controllers/delme.php Line Number: 16 btw, access to http://www.my-site.com/index.php?c=delme&m=index is ok. Basically my questions simply are [b]1. how to pass multiple parameters to a method in controller, under my configration (please see the first post)? 2. if the controller is in a sub-folder of the "controllers" folder, then how to pass parameters to a method in that controller? Thanks.
[eluser]Dready[/eluser]
hello, you need to catch variables from PHP global variable $_REQUEST : Code: function greeting($name = '',$times = ''){ and then use http://www.my-site.com/index.php?c=delme...in×=5
[eluser]KevinLG[/eluser]
You rock! That works. I was thinking I could use something similar to params[...] stuff. But I am happy with this too! Can someone help me with this subfolder controller thingy(what's the URL for a controller in a subfolder)? Many thanks.
[eluser]Dready[/eluser]
Looking at the code in version 1.5.4 you can't do it without modification to the core of the framework.
[eluser]Majd Taby[/eluser]
don't use $_REQUEST, it's a bad idea, $_REQUEST gets anything (post, cookie, get), all of which can be tampered with. |
Welcome Guest, Not a member yet? Register Sign In |