We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Custom search, posted variables and pagination

Development and Programming

Ace Prod's avatar
Ace Prod
111 posts
14 years ago
Ace Prod's avatar Ace Prod

Hi guys,

Running 1.6.8 build 20090723

I need to do a custom search - enter a postcode and a distance and get the results within that area.

The PHP code I am using generate a list of entry ids that match the criteria, which I then parse into a {exp:weblog:entries} tag.

This works fine until I use pagination and the posted variables used in the query are lost.

Is there a way to store either the posted variables or the query results so they can be used through pagination?

Thanks.

Edit: I did get it working with Cookie Plus and embeds, but because of the parse order, the results were always a search behind.

[Mod Edit: Moved to the Development and Programming forum]

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
14 years ago
John Henry Donovan's avatar John Henry Donovan

Hi David, yes cookies would be the way to go or even a third party module to handle search. Have you seen SuperSearch from Solspace?

       
Ace Prod's avatar
Ace Prod
111 posts
14 years ago
Ace Prod's avatar Ace Prod

Thanks John.

I don’t think SuperSearch will be for us.

I would really appreciate some help getting to grips with the best way of getting the Cookies to update on page load.

Simplified code below:

<?
if ($IN->GBL('txt_postcode', 'POST')) {
    // code to work out the entry ids...
    // ...
    $ids = '1,2,3,4,5,6';
    echo '{exp:cookie_plus:set name="cookiename" value="'.$ids.'" seconds="3600"}';
}
?>

<!DOCTYPE....

<form method="post">
    <input type="text" name="txt_postcode" value="la2" />
    <input type="submit" name="submit" />
</form>

{exp:cookie_plus:get name="cookiename"}

In this template I obviously have PHP enabled and am parsing on input. If I click on submit, the Cookie is not updated. If I click on submit again, the Cookie is updated with the last submitted information.

For example, if I submit a postcode value of LA2, nothing is returned as the cookie value. If I then submit a postcode value of BB1, LA2 is returned as the cookie value.

How can I make sure that when LA2 is submitted, the cookie value is immediately updated?

Thanks!

       
Ace Prod's avatar
Ace Prod
111 posts
14 years ago
Ace Prod's avatar Ace Prod

I got round this by parsing the variables I needed through the paginate_base parameter.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.