2011 Posts in 1436 Topics by 620 members
|Go to End|
6 January 2011 at 11:37am
I am building a site in 2.4.4 and have enabled the search box with the following in my _config.php file:
I have created two page types that extend SiteTree: Page and HomePage. When I submit the search form from the home page, the search results display in the HomePage.ss template, using the Page_results.ss layout and when I submit the form from an interior page, the search results display in the Page.ss template, using the Page_results.ss layout. This is not good because the HomePage and Page templates don't really have anything in common and that's why they are separate and both just extend SiteTree. I want the search results to always use the Page.ss template and the Page_results.ss layout, whether I submit the search form from the home page or an interior page.
I had found another thread in this forum that suggests adding a line to the function results() in your Page.php file like this:
'ClassName' => 'Page_results'
The problem is that in this version of SilverStripe, the function for the search results is built into the core and isn't in Page.php anymore. How can I specify the template that I always want the search results to use?
|Go to Top|