21309 Posts in 5738 Topics by 2603 members
| Go to End | ||
| Author | Topic: | 2351 Views |
-
Re: Search not working

14 September 2011 at 2:52pm Last edited: 14 September 2011 3:18pm
It works!
Solution taken: move Page_results.ss out of /Layout and back into /Templates
Had to rewrite the whole Page_results.ss 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!
Thanks!
-
Re: Search not working

14 September 2011 at 10:41pm
OK, that's it then. And yes, you can remove Page-results.ss from Layout. As for the why: Layout is used to make it possiblee to create a wrapper template /templates/Page.ss 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 Page.ss, GalleryPage.ss, SomeOtherPageType.ss. 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/HomePage.ss, 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
-
Re: Search not working

18 September 2011 at 7:45pm Last edited: 18 September 2011 7:45pm
Ok... I have done the following and still search is not working:
Firslty I have added $SearchForm to the page.ss file in mysite/themes/wine/templates/page.ss
The file now looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><% base_tag %>
$MetaTags
<link rel="shortcut icon" href="/favicon.ico" /></head>
<body>
$SearchForm
<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>
<div id="Nav">
<% include Navigation %>
</div>$Layout
<div class="clear"></div><div id="Footer">
<% include Footer %>
</div></div>
</body>
</html>Secondly I have added FulltextSearchable::enable(); to the _config.php file in mysite/_config.php
The file now looks like this:
<?php
FulltextSearchable::enable();
LeftAndMain::require_javascript('userforms/javascript/FieldEditor.js');
LeftAndMain::require_css('userforms/css/FieldEditor.css');?>
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??
-
Re: Search not working

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 SearchForm.ss template hanging around somewhere in your mysite or your (wine) theme directory or anywhere else you can think of besides the saphhire/cms directory?
| 2351 Views | ||
| Go to Top |


