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.

Customising the CMS /

Controlling Page_results.ss


Reply


3 Posts   1765 Views

Avatar
Rawbit

Community Member, 52 Posts

4 April 2009 at 7:40am

When I do
<% if ClassName = HomePage %> it returns ture on my search results! There are some bits that I don't wish to show on the results page that are on the Home page (for example I have a flash carousel that is controlled with a checkbox 'has_carousel').

I tried something like this:

<% if hasFlashCarousel %>
   <% if ClassName = Page_results %>
      ... do nothing
   <% else %>
      include carousel...
   <% end_if %>
<% end_if %>

but <% if ClassName = Page_results %> is not working... any ideas how i control this?
   
      

Avatar
Willr

Forum Moderator, 5513 Posts

4 April 2009 at 6:25pm

In your function results() in mysite/code/Page.php add another entry to your return array(... ) bit

'ClassName' = 'Page_results'

as you call the results method on the current page you are viewing it inherits all the information from this page. So if you search from the homepage it does http://silverstripe.org/home/SearchForm.. which loads the results but ontop of the home page. Passing the returned array another option should fix it

Avatar
Rawbit

Community Member, 52 Posts

16 April 2009 at 12:21am

Edited: 16/04/2009 12:48am

Ah awesome thanks!

PS
'ClassName' => 'Page_results'

:)