Search & Pagination

#3
[eluser]pickupman[/eluser]
You can shorten the syntax using ternary operators.
Code:
$localitate = ($this->session->userdata('search_loc')) ? $this->session->userdata('search_loc') : 0;
    
$categorie = ($this->session->userdata('search_cat')) ? $this->session->userdata('search_cat') : 0;

$search_term = ($this->session->userdata('search_term')) ? $this->session->userdata('search_term') : '';

Whenever you want to paginate search results you can do it one of 2 ways.
1.) Store the search params in the session like you are doing now. And then pass to your model for the results.
2.) Store the params in the DB. This is how it is done here on the boards. When you search, the terms are added to the DB, then the DB returns a record number, and you redirect the user to site.com/search/results/IDNumber. Similar to sessions you can add a timestamp to the record, and purge any searches older than a certain time. This allows allows you to cache the result of the search if someone else search the same term in a given time period.


Messages In This Thread
Search & Pagination - by El Forum - 06-17-2010, 08:59 AM
Search & Pagination - by El Forum - 06-17-2010, 09:13 AM
Search & Pagination - by El Forum - 06-17-2010, 10:04 AM
Search & Pagination - by El Forum - 06-17-2010, 11:01 AM
Search & Pagination - by El Forum - 06-17-2010, 02:48 PM
Search & Pagination - by El Forum - 06-18-2010, 01:34 AM
Search & Pagination - by El Forum - 06-18-2010, 02:35 AM
Search & Pagination - by El Forum - 06-18-2010, 03:08 AM
Search & Pagination - by El Forum - 06-18-2010, 06:52 AM
Search & Pagination - by El Forum - 06-19-2010, 04:14 PM
Search & Pagination - by El Forum - 06-20-2010, 07:35 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.