Jump to:

22996 Posts in 11844 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Search not working

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

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

Page: 1 2 3 4
Go to End
Author Topic: 3176 Views
  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Search not working Link to this post

    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!

  • martimiz
    Avatar
    Forum Moderator
    1038 Posts

    Re: Search not working Link to this post

    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

  • bettsaj
    Avatar
    Community Member
    46 Posts

    Re: Search not working Link to this post

    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??

  • martimiz
    Avatar
    Forum Moderator
    1038 Posts

    Re: Search not working Link to this post

    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?

    3176 Views
Page: 1 2 3 4
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.