Reputation: 1669
In few pages I need to make pagination. This of course can be achieved with URI segments, but in few cases in addition to pagination parameters, I need to pass some other GET parameters for filtering purposes.
So obviously in this case i need to be able access the controller via query string like so:
example.com/?c=controller&m=function
In order to achieve this I set the enable_query_strings
to TRUE in main config file.
This seemed to work, but I discovered that it breaks a bunch of different stuff. For example if I use current_url()
the URL returned has a ?
at the end to accommodate the query string. So if I use it in form, it does not work.
So is there any way to enable the controller access to controller functions only to specified functions?
Upvotes: 2
Views: 270
Reputation: 8830
Instead of enabling enable_query_strings in main config, just enable in pagination config only. So it will apply to that particular page only.
Ex:
$config['page_query_string'] = TRUE;
Upvotes: 0
Reputation: 1357
You can construct you url like this:
/param1/param2/pagination_parameters
So you will be able to send custom data (number of params), and pagination data using just URI segments.
For example if I use current_url() the URL returned has a ? at the end to accommodate the query string. So if I use it in form, it does not work.
Please note, that you can also left form 'action' blank, so result will be the same as if you had used current_url() (http request will go to the same script).
Upvotes: 1