Jump to:

17452 Posts in 4473 Topics by 1971 members


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: 1307 Views
  • Rube_25
    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">

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

    and fails to appear

    'm doing something wrong?

    thanks for the help

    Excuse my English

  • ojalà
    Community Member
    87 Posts

    Re: problem with search form Link to this post

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

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.