Welcome Guest, Not a member yet? Register   Sign In
Question regarding the uri + more
#2

[eluser]jedd[/eluser]
Hi Dennis and welcome to the CI forums.

Quote:1) URI - I understand that the URI uses <optional folder>/class/function/variables so lets say I create a controller named search and I want the user to be able to type example.com/search/<search variable> to get a search result, meaning the index page (function) is the search result page, but CI expect the second parameter to be the function and therefore I have to write example.com/search/index/<search variable>, is it somehow possible to skip the index in the url to get a more clean url?

There are several things you can search in the user guide - ROUTES, REMAP, REDIRECT - but you are probably approaching the problem the wrong way. As in, you are unlikely to have a controller called search - your controller would be named after a resource that your site lets you manage, and one of the functions in there would be search.

Quote:2) GET forms - This question is related to the first one, lets say I create a search form with a GET method, when i submit this form I get in return a normal query string like this example.com/search?id=<my_search> instead of example.com/search/<my_search>. Is there some option to enable seo URIs on GET forms?

We don't like GETs, and much prefer POSTs.

You can enable the query string style of URI's if you want - search the user guide for QUERY STRING.


Quote:3) sessions - I feel a little "unused" to the CI sessions, I understand that the session is stored in the cookies but shouldn't the session end once the user close the browser? For now the session is kept even if you close the browser.

Unencrypted sessions shouldn't contain sensitive data. If you have a a situation where you want better security, you'd encrypt the session. There are several threads in the forums on different approaches to doing what you want to do here, as the question pops up regularly. And yes, it does appear to be a feature we could do with in the core.

Quote:4) I would like to automatically run some lines of code before I initiate any script in an controller, is this possible without changing any of the "core" files?

Search the user guide for MY_CONTROLLER - it's the answer to all your prayers.


Messages In This Thread
Question regarding the uri + more - by El Forum - 06-30-2009, 10:10 AM
Question regarding the uri + more - by El Forum - 06-30-2009, 10:36 AM
Question regarding the uri + more - by El Forum - 06-30-2009, 12:09 PM
Question regarding the uri + more - by El Forum - 06-30-2009, 12:33 PM
Question regarding the uri + more - by El Forum - 06-30-2009, 02:20 PM
Question regarding the uri + more - by El Forum - 07-02-2009, 04:38 AM
Question regarding the uri + more - by El Forum - 07-02-2009, 07:47 AM
Question regarding the uri + more - by El Forum - 07-02-2009, 02:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB