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:

Archive /

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

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

problem with search form


Go to End


3 Posts   1506 Views

Avatar
Rube_25

Community Member, 36 Posts

2 October 2008 at 4:35am

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

Avatar
ojalà

Community Member, 87 Posts

9 October 2008 at 4:52am

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?

Avatar
vstrazz

Community Member, 63 Posts

11 October 2008 at 6:26am

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.