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   1695 Views

Avatar
Rawbit

4 April 2009 at 7:40am Community Member, 52 Posts

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

4 April 2009 at 6:25pm Forum Moderator, 5511 Posts

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

16 April 2009 at 12:21am (Last edited: 16 April 2009 12:48am), Community Member, 52 Posts

Ah awesome thanks!

PS
'ClassName' => 'Page_results'

:)