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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

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

Show search parameters in Results Page (CustomSearchContext)


Go to End


10 Posts   2965 Views

Avatar
Martijn

Community Member, 271 Posts

8 September 2010 at 8:15am

Edited: 08/09/2010 8:15am

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

Community Member, 42 Posts

8 September 2010 at 8:17pm

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

Go to Top