title: Basic search in wordpress
body: <p>I am creating a wordpress template in which I want to integrate a simple search form. I googled a lot about this in the last 3 days and tried several tutorials but I am afraid there is something I don't get at all. I have 3 pages for the search: <code>search.php</code>, <code>searchform.php</code> and <code>searchpage.php</code>. All the tutorials I read provide similar code like this:</p>
  
  <p>search.php:</p>
  
  <pre><code>&lt;?php if (have_posts()) : ?&gt;
  …
  &lt;?php while (have_posts()) : the_post(); ?&gt;
  …
  &lt;?php endwhile; else: ?&gt;
  … &lt;p&gt;The key word &lt;strong&gt;&lt;?php the_search_query(); ?&gt;&lt;/strong&gt; is not on this website.&lt;/p&gt;
  &lt;?php include (TEMPLATEPATH . "/searchform.php"); ?&gt;
  &lt;?php include (TEMPLATEPATH . "/searchpage.php"); ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>searchform.php:</p>
  
  <pre><code>&lt;?php 
  $querystring = esc_attr(apply_filters('the_search_query', get_search_query()));
  $searchstring = "Suchbegriff eingeben";
  if (empty($querystring)) { $querystring = $searchstring; }
  ?&gt;
  
  &lt;form method="get" id="searchform" action="&lt;?php bloginfo('url'); ?&gt;/"&gt;
  &lt;div&gt;
      &lt;input type="text" name="s" id="s" value="&lt;?php echo $querystring; ?&gt;"
          onblur="if (this.value == '') { this.value = '&lt;?php echo $searchstring; ?&gt;'; }"
          onfocus="if (this.value == '&lt;?php echo $searchstring; ?&gt;') { this.value = ''; }" /&gt;
      &lt;input type="submit" id="searchsubmit" value="Suchen" /&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>searchpage.php (adapted from page.php):</p>
  
  <pre><code>&lt;?php
  /*
  Template Name: Search Page
  */
  ?&gt;
  
  &lt;div id="content"&gt;
  
  &lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?&gt;
  
      &lt;div class="blogpost"&gt;
          &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
          &lt;?php the_content(); ?&gt;
          &lt;?php $this-&gt;posts = $wpdb-&gt;get_results($this-&gt;request); ?&gt;
      &lt;/div&gt; &lt;!-- end class blogpost --&gt;
  &lt;?php endwhile; ?&gt;
  
  &lt;/div&gt;
  &lt;?php get_sidebar(); ?&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>If there is no match with the key word the search works. But if there is a match I only get <code>… … … … … … …</code> as output. I know that must be from the <code>search.php</code> but I have no idea how I can change that. Thanks for your advise and help, I really appreciate it!</p>