Jump to:

5451 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Controlling Page_results.ss

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

Page: 1
Go to End
Author Topic: 1635 Views
  • Rawbit
    Avatar
    Community Member
    52 Posts

    Controlling Page_results.ss Link to this post

    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?
       
          

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Controlling Page_results.ss Link to this post

    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

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Controlling Page_results.ss Link to this post

    Ah awesome thanks!

    PS
    'ClassName' => 'Page_results'

    1635 Views
Page: 1
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.