Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Show search parameters in Results Page (CustomSearchContext)

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2086 Views
  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Show search parameters in Results Page (CustomSearchContext) Link to this post

    Ah, my bad:

    new TextField('PrixMin', 'Prix Min', $PrixMin),
    new TextField('PrixMax', 'Prix Max', $PrixMax)

    If you want to create the vars in a template, you will need to create a method in your page to return the postVars.

    something like:

    function PrixMinPostVar(){
    if(isset($this->request)){
    return $this->request->postVar('PrixMin');
    }
    }

  • VRoxane
    Avatar
    Community Member
    42 Posts

    Re: Show search parameters in Results Page (CustomSearchContext) Link to this post

    1. Should I put this in BienImmo.php (DataObject) or in ListeBiens.php (Page where I show BienImmos) ?

    2. After that, will I access the variable like this ?

    <% control PrixMinPostVar %>
    $PrixMin
    <% end_control %>

    3. Can I add more variables in the function, like this :

       function PrixMinPostVar(){
          if(isset($this->request)){
             return $this->request->postVar('PrixMin');
          }
          if(isset($this->request)){
             return $this->request->postVar('PrixMax');
          }
          if(isset($this->request)){
             return $this->request->postVar('Loc_Ville');
          }
       }


    and get them in the template after that ?

    4. In the Loc_Ville case, does it return an array ? How do I handle it in the template ?

    I know, I have a lot of questions but "One knowing is better than Ten searching" !

    2086 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.