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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Search results template not rendering


Go to End


2 Posts   2514 Views

Avatar
ianpiper

Community Member, 32 Posts

15 March 2009 at 4:12am

Edited: 15/03/2009 4:22am

Hi all,

I'm having trouble with rendering results from a search. I am using v2.3 and the installation had a SearchForm method already (slightly different from the one in the tutorial) so I used that. I created a template called Page_results.ss and put the code from tutorial 4 in it. When I run the search it seems to ignore the Page_results.ss file and instead loads Page.ss. I would have expected this if there were not Page_results.ss in the Layout folder because of this code in Page.php:

return $this->customise($data)->renderWith(array('Page_results', 'Page'));

But in this case there is a file called Page_results.ss, so why is it not being used?

BTW I can be certain that Page.ss is the template that is rendering here and that the search is running, because if I put the search results handling code into Page.ss then it shows the appropriate results.

If anyone can illuminate me I'd be grateful.

Regards,

Ian.
--

Ian.
--

Avatar
ianpiper

Community Member, 32 Posts

15 March 2009 at 4:34am

<blush>I forgot to rebuild my database</blush>. Once I did that the correct results page loaded.