Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » problem with search form

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1295 Views
  • Rube_25
    Avatar
    Community Member
    36 Posts

    problem with search form Link to this post

    hi everybody

    I was watching the tutorial http://doc.silverstripe.com/doku.php?id=tutorial:4-site-search

    and follow the steps until:

    1) mysite\code page.php I put the following code:

    class Page_Controller extends ContentController {
    function SearchForm() {
    $searchText = isset($this->Query) ? $this->Query : 'Search';
          
    $fields = new FieldSet(
    new TextField("Search", "", $searchText)
    );

    $actions = new FieldSet(
    new FormAction('results', 'Go')
    );

    return new SearchForm($this, "SearchForm", $fields, $actions);
    }
    }

    2) templates/Page.ss    within the header put:

    <div id="Header">
    $SearchForm
    <h1>$Title</h1>
    </div>

    3) www.mysite.com/db/build?flush=1

       
    and fails to appear

    'm doing something wrong?

    thanks for the help

    Excuse my English
    rube

  • ojalà
    Avatar
    Community Member
    87 Posts

    Re: problem with search form Link to this post

    Hi!
    I put the code that you write in mysite/code/Page.php also in tutorial/code/Page.php because they are link (I found thi information in this forum) but I have your problem: the search form doesn't appear in the page.
    Have you solve? if yes can you explain me please?

  • vstrazz
    Avatar
    Community Member
    63 Posts

    Re: problem with search form Link to this post

    if you are running a tutorial site like ojala said, you will need to put the code in tutorial/code/page.php and you will also have to put $SearchForm in the tutorial/themes/ folder not the mysite.. thats if you're running the tutorial install.

    1295 Views
Page: 1
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.