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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Search not working

Go to End

28 Posts   5990 Views


Community Member, 143 Posts

14 September 2011 at 2:52pm

Edited: 14/09/2011 3:18pm

It works!

Solution taken: move out of /Layout and back into /Templates

Had to rewrite the whole to include all those #divs, but its works.

Will also have to restyle everything.

One questions:

1) Is there any harm moving Page_results out of /Layout?? Id wouldnt think so.

- - -

Ill sleep better!



Forum Moderator, 1391 Posts

14 September 2011 at 10:41pm

OK, that's it then. And yes, you can remove from Layout. As for the why: Layout is used to make it possiblee to create a wrapper template /templates/ for all pagetypes that are styled alike. Then, where the contents that are different for each pagetype should be, you put $Layout.

Next in your /template/Layout directory you can put template blocks for your different pagetypes in,, SilverStripe automatically include the appropriate part from the Layout directory.

If you have a pagetype like HomePage that should be styled completely different, you just place it in /templates/, and skip the $Layout part. And that's what you're doing for all your pages at the moment...

Advice: take a look at the SilverStripe tutorials and help, where these things are explained, now the pressure's off :-)


Community Member, 46 Posts

18 September 2011 at 7:45pm

Edited: 18/09/2011 7:45pm

Ok... I have done the following and still search is not working:

Firslty I have added $SearchForm to the file in mysite/themes/wine/templates/

The file now looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

		<% base_tag %>
		<link rel="shortcut icon" href="/favicon.ico" />

<div id="Wrapper">
	<div id="Header">
	    <h1><span>Christina French</h1>
        <p class="tagline">Artist & Tutor</p>
        <input type="text" class="search" value="Search" />
    <div id="Nav">
    	<% include Navigation %>
    <div class="clear"></div>
    <div id="Footer">
    	<% include Footer %>


Secondly I have added FulltextSearchable::enable(); to the _config.php file in mysite/_config.php

The file now looks like this:




I have run a dev/build and when the page refreshed there was nothing that looked like it had changed. could this be something to do with the template i'm using... If so should I look at some of the other search tutorials??


Forum Moderator, 1391 Posts

19 September 2011 at 2:00am

No, unless you're referring to some other site now, your code still shows only a single searchfield, that isn't part of a form, so it cannot work. Some questions:

- did you create a function SearchForm() in your Page_Controller? What does it say?

- did you create a function results() in your Page_Controller? What does it say?

- do you by any chance have a template hanging around somewhere in your mysite or your (wine) theme directory or anywhere else you can think of besides the saphhire/cms directory?

Go to Top