Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions

Show search parameters in Results Page (CustomSearchContext)


Reply

10 Posts   2118 Views

Avatar
Martijn

8 September 2010 at 8:15am (Last edited: 8 September 2010 8:15am), Community Member, 271 Posts

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');
}
}

Avatar
VRoxane

8 September 2010 at 8:17pm Community Member, 42 Posts

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" !