[eluser]stoefln[/eluser]
I love the standard routing mechanism of CI (Controller/Method/Arguments) but what if i have GET parameters which can occur on each page, like lets say a get parameter for paging the comments which can be postet on each page.
each page(method in controller) can have a different number of arguments, so i cant this read this comment_posting_start parameter with e.g. $this->uri->segment(3).
Any ideas?
[eluser]Bramme[/eluser]
Use ajax to paginate them? Just a wild idea though.
[eluser]Thorpe Obazee[/eluser]
I usually use controller/method/keyword/page_number
I get the 'current page' from the URL.
[eluser]stoefln[/eluser]
Ajax is a good idea, but not the one i m searching for.
@chamyto: if you use always 4 segments there is no problem. but i m writing a webapp consisting of different controllers with different methods with different arguments, so the segment for the "comment_posting_start" differs too.
is there maybee a possibility to attach a query parameter like
/controller/method/parmam1/.../paramN/?comment_posting_start=40
[eluser]Bramme[/eluser]
you could add 'commentstart-40' to your uri, and then loop through all your uri segments and check if there's one that has 'commentstart-' in it. If TRUE, cut off commentstart- and you've got your offset.
Not sure how this would affect your performance.
[eluser]stoefln[/eluser]
[quote author="Bramme" date="1220106501"]you could add 'commentstart-40' to your uri, and then loop through all your uri segments and check if there's one that has 'commentstart-' in it. If TRUE, cut off commentstart- and you've got your offset.
Not sure how this would affect your performance.[/quote]
true, but i have to check in each controller method whether the argument contains a "commentstart". would be great if the framework could do this for me.
[eluser]Bramme[/eluser]
You're right... It would be great if you could add parameters not bound to uri segments... However, even if the framework would do it for you, I don't immediatly see another way then to strpos for a certain flag...
Unless you'd add a function add_uri_segment that would log where you put it...