ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Best way to structure code for multiple sort orders

April 05, 2012 1:09pm

Subscribe [3]
  • #1 / Apr 05, 2012 1:09pm

    dlhacker

    1 posts

    I have kind of a Newbie Question…

    I am looking to allow users of a site I am building to re-sort database listings by Name, Rating,Distance and so on. What is the most efficient way to code this in EE… Dynamic-Parameters? If so, I understand that pagination may be an issue. Also is it best to use a form element (i.e. drop-down or radio selection) and call a reusable template?

    Any help or examples of code would be greatly appreciated.

    -Don

  • #2 / Apr 05, 2012 2:10pm

    Shane Eckert

    7174 posts

    Hey dlhacker,

    I am going to move this out of Pre-Sales and over to the Community Help Forum where the community can help you with a code example.

    Cheers,

  • #3 / Apr 05, 2012 2:45pm

    the3mus1can

    426 posts

    In “my opinion” the proper way to handle this is using query string variables, but alas that is a pain when it comes to EE.

    You will need to change $config[‘uri_protocol’] = ‘AUTO’ (system/expressionengine/config/config.php) to either PATH_INFO, REQUEST_URI, or ORIG_PATH_INFO depending on your hosting setup.

    You will also need to hack the Pagination class to add support for adding query string variables to the pagination links. I also create a .changelog file in the root of the project that details when I make changes to EE or any third party add-on I didn’t create. Of course this means when doing upgrades always look at the .changelog to port any changes to the new version as needed.

    Something like this in the pagination class so that the query string variables are persisted across the paginated pages.

    $this->suffix = http_build_query($_GET);
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases