SOLUTION: Ein flexibler, update-tauglicher Lösungsansatz besteht darin, die Erzeugung der Ergebnisliste über ein dem zentralen Template entsprechend benamtes lokales DTML-Template "bodyContent_Search" zu modifizieren. Der Code von f_bodyContent_search.dtml bietet dazu eine gute Ausgangsbasis:

<!-- BO bodyContent_Search -->

<script language="JavaScript">
<!--//

  //* Preload image.
  img_wait_search = new Image;
  img_wait_search.src = '<dtml-var MISC_ZMS>wait_search.gif';

  //* Swap image on form-submit.
  function onFormSubmit(fm)
  {
    <dtml-if management_interface>
      document.img_wait_search.src = img_wait_search.src;
    </dtml-if>
  }

//-->
</script>

  <dtml-unless search_order_by>
    <dtml-call "REQUEST.set('search_order_by',1)">
  </dtml-unless>
  <dtml-unless option>
    <dtml-call "REQUEST.set('option','OR')">
  </dtml-unless>
  <dtml-unless searchform>
    <dtml-call "REQUEST.set('searchform','1')">
  </dtml-unless>

  <!-- HEADER -->
  <dtml-if "REQUEST.has_key('raw') and _.int(searchform)==1">
    <p class="heading1"><dtml-var 
    "getLangStr('SEARCH_HEADERAGAIN',manage_lang)"></p>
  <dtml-else>
    <p class="heading1"><dtml-var 
    "getLangStr('SEARCH_HEADER',manage_lang)"></p>
  </dtml-if>

  <!-- FORM -->
  <form action="<dtml-var URL>" method="get" onsubmit="onFormSubmit(this)">
  <dtml-if management_interface>
   <input type="hidden" name="lang" value="<dtml-var lang>">
   <input type="hidden" name="manage_lang" value="<dtml-var manage_lang>">
   <input type="hidden" name="preview" value="preview">
  </dtml-if>
  <input type="hidden" name="searchform" value="<dtml-var searchform>">


  <!-- ###################### -->
  <!-- ### Form Input Fields  -->
  <!-- ###################### -->

  <dtml-if "_.int(searchform)==1">
  <table cellspacing="2">
  <tr valign="middle">
    <td class="form-label"><dtml-var 
    "getLangStr('ATTR_SEARCHTERM',manage_lang)">:</td>
    <td colspan="2" class="form-element">
        <input class="form-element" type="text" name="raw" size="18"
          <dtml-if "REQUEST.has_key('raw')">value="<dtml-var "REQUEST['raw']" 
          html_quote>"</dtml-if>>
    </td>
    <td align="left" valign="top"><img name="img_wait_search" 
    src="<dtml-var spacer_gif>" alt="" border="0" width="45" height="44"></td>
  </tr>
  <tr valign="middle">
   <td class="form-label"><dtml-var 
   "getLangStr('ATTR_OPTION',manage_lang)">:</td>
   <td class="form-element">
    <select class="form-element" name="option">
     <dtml-in "['AND','OR']">
      <option value="<dtml-var "_['sequence-item']">"
       <dtml-if "REQUEST['option']==_['sequence-item']">
        selected="selected"
       </dtml-if>
      ><dtml-var "getLangStr(_['sequence-item'],manage_lang)"></option>
     </dtml-in>
    </select>
   </td>
   <td align="right" valign="top" rowspan="2" nowrap="nowrap">
    <div class="form-small"><font style="font-size:10px"><dtml-var 
    "getLangStr('SEARCH_HINT',manage_lang)"></font></div></td>
   </td>
  </tr>
  <tr valign="middle">
    <td class="form-label"><dtml-var 
    "getLangStr('ATTR_ORDERBY',manage_lang)">:</td>
    <td class="form-element">
        <select class="form-element" name="search_order_by:int">
          <dtml-in "_.range(1,2+1)">
            <option value="<dtml-var "_['sequence-item']">"
              <dtml-if "_.int(REQUEST['search_order_by'])==_['sequence-item']">
                selected="selected"
              </dtml-if>
            ><dtml-var "getLangStr('SEARCH_ORDERBY%i'%_['sequence-item'],
            manage_lang)"></option>
          </dtml-in>
        </select>
    </td>
  </tr>
  <tr valign="middle">
    <td></td>
    <td class="form-element">
        <input class="form-element" type="submit" name="btn" 
        value="<dtml-var "getLangStr('BTN_SEARCH',manage_lang)" html_quote>">
    </td>
  </tr>
  </table>
  </dtml-if>

  </form>

<!-- ################### -->
<!-- ### Search Results  -->
<!-- ################### -->

<dtml-if "REQUEST.has_key('raw')">

 <dtml-call "REQUEST.set('_s',getCatalogQueryString(raw,option))">
 <dtml-call "REQUEST.set('res',submitCatalogQuery(REQUEST.get('_s',''),
 REQUEST.get('search_order_by',1),REQUEST.get('search_meta_types',[]),REQUEST))">

 <h2><dtml-var "getLangStr('SEARCH_HEADERRESULT',manage_lang)"></h2>
 <p><dtml-var "getLangStr('SEARCH_YOURQUERY',manage_lang)%(
 '<b>%s</b>'%REQUEST['_s'])"></p>

 <dtml-if "_.len(res)==0">
 
  <p><dtml-var "getLangStr('SEARCH_NORESULTS',manage_lang)"></p>
  
 <dtml-else>

  <!-- max score -->
  <dtml-call "REQUEST.set('_score_factor',1.0)">
  <dtml-if "res[0]['score']>5">
   <dtml-call "REQUEST.set('_score_factor',_.float(5.0/_.float(res[0]['score'])))">
  </dtml-if>

  <!-- qs: query-start -->
  <dtml-call "REQUEST.set('qs',REQUEST.get('qs',1))">

  <!-- qe: query-end -->
  <dtml-call "REQUEST.set('qe',_.len(res))">
  <dtml-in res next size=10 start=qs>
   <dtml-in next-batches mapping>
    <dtml-if "qe==_.len(res)">
     <dtml-call "REQUEST.set('qe',_['batch-start-number']-1)">
    </dtml-if>
   </dtml-in>
  </dtml-in>

  <p><dtml-var "getLangStr('SEARCH_RETURNEDRESULTS',manage_lang)">:</p>
  <p><b><dtml-var 
  "getLangStr('SEARCH_RETURNEDSTATS',manage_lang)%(_.int(qs),_.int(qe),_.len(res))">
  </b></p>
  <dtml-call "REQUEST.set('_u',getCatalogNavUrl(REQUEST))">

  <!-- NAVIGATION -->
  <dtml-var search_nav_html>

  <!-- FOUND -->
  <table cellspacing="0" cellpadding="0" border="0">
  <dtml-in res size=10 start=qs mapping>
   <tr>
    <td align="left">
     <a <dtml-if management_interface>
      href="javascript:followHref('<dtml-var 
      "url.replace('index_%s.html?preview=preview'%(lang),
      'manage_main?lang=%s&manage_lang=%s&preview=preview'%(lang,manage_lang))">')"
     <dtml-else>
      href="<dtml-var url>"
     </dtml-if>><b><dtml-var title></b></a>
    </td>
   </tr>
   <dtml-if description>
    <tr>
     <td align="left"><dtml-var description></td>
    </tr>
   </dtml-if>
   <tr>
    <td align="left" class="navMicro">
     <a <dtml-if management_interface>
      href="javascript:followHref('<dtml-var 
      "url.replace('index_%s.html?preview=preview'%(lang),
      'manage_main?lang=%s&manage_lang=%s&preview=preview'%(lang,manage_lang))">')"
     <dtml-else>
      href="<dtml-var url>"
     </dtml-if>><dtml-in "ob.breadcrumbs_obj_path()">» <dtml-var 
     "string_maxlen(getTitlealt(REQUEST),20)"><dtml-unless sequence-end> 
     </dtml-unless></dtml-in></a>
     - <dtml-var "getLangFmtDate(time,lang,'%d')"> <dtml-var 
     "getLangFmtDate(time,lang,'Month')[:3]"> <dtml-var 
     "getLangFmtDate(time,lang,'%Y')">
    </td>
   </tr>
   <dtml-unless sequence-end>
    <tr>
     <td><br></td>
    </tr>
   </dtml-unless>
  </dtml-in>
  </table>

  <!-- NAVIGATION -->
  <dtml-var search_nav_html>

 </dtml-if>

</dtml-if>

<!-- EO bodyContent_Search -->

COMMENT: In der Suchform werden zwei hidden fields übergeben: 'searchform' für die Anzeige der Reformulierungsform und der Operator 'op', der dazu dient, die Darstellungstemplates der Navigation ggf. anzupassen. Der eigentliche Querystring wird aus der Variablen 'raw' erzeugt.

Erstellt von: Dr. F. Hoffmann , erstellt am:  27.06.2008 , zuletzt geändert: 19.07.2008

Erstellt von: Dr. F. Hoffmann , erstellt am:  27.06.2008 , zuletzt geändert: 19.07.2008