2

I have a custom table exp_jobs which I am querying. I have used {exp:query} and have also been trying out http://devot-ee.com/add-ons/activerecord ...

Having 1 issue which I think could be solved a few ways. The issue is when you page through the results page 2 I lose the value I am search for. So if I have search form and I do a post I get: http://website.com/jobs?keyword=medical&job_state=AL

Works fine.

Going to page 2 and I the query string is gone, which I expect. I need to be able to alter the paging links however the {pagination_links} pair doesn't work for exp:query even though the docs say:

The pagination in the Query module works exactly like the Channel and Comment Pagination with only one exception. Instead of using a LIMIT clause in your query, use the limit=”“ parameter to specify how many results to display per page, and ExpressionEngine will automatically modify your query to display the appropriate results.

Somehow I need to override the standard pagination to include the query string, any thoughts on how I can do that or plugin I may have overlooked. Tried a bunch.

I also looked at cookies and sessions but not getting consistent results. I may just need to write my own plugin here to handle this if all else fails.

Thank you!

UPDATE: April 20, 2013

I ended up using jQuery to append the URL based on an earlier recommendation from Rob

<script type="text/javascript">
var querystring = '{querystring}';

$('#paging a').each(function()
{
 var href = $(this).attr('href');
 href += (href.match(/\?/) ? '&' : '?') + querystring;
 $(this).attr('href', href);
});
</script>
1

Take a look at the channel_module_create_pagination hook. Don't be fooled by the name, it doesn't just work with the channel module.

I've also had success using Low Replace wrapped around pagination tags to manipulate pagination URLs. This might not be easy, though.

| improve this answer | |
  • Thanks Rob --- I tried Low Replace just now: {exp:low_replace find="jobs" replace="foo" casesensitive="no"} {paginate} <p>Page {current_page} of {total_pages} pages {pagination_links}</p>{/paginate} {/exp:low_replace} Didn't seem to replace anything. I will take a look at the other. – Brian Peddle Apr 19 '13 at 22:01
  • Rob -- I think I solved this with jQuery as you origianlly mentioned on github -- github.com/rsanchez/mo_variables/issues/24 Trying to make a tweak to mo variables now to return - $qry = (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING'] != '') ? '?'. $_SERVER['QUERY_STRING'] : ''; using {query_string} – Brian Peddle Apr 19 '13 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.