Beider Einbindung der Suche bin ich auf 2 mir nicht erklärbare Probleme gestoßen.
Zum Ersten:
Ich habe in meiner Seite die Hauptnavigation zusammen mit der Suche in eine Datei ausgelagert, die ich in jedes Seiten-Template mit <we:include ...> einbinde. So weit so gut. Das Suchformular sieht dabei so aus:
- Code: Alles auswählen
<we:ifNotWebEdition><we:form id="273" xml="true"></we:ifNotWebEdition>
<table class="suchleiste" width="691" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="431">
<ul class="navi_oben">
<we:linklist name="navi_top">[*]<we:link /></li></we:linklist>
[/LIST]
</td>
<td width="214" align="right"><span class="suche">Suche:</span> <we:search type="textinput" size="50" class="suchfeld" name="suche" xml="true" id="text" /></td>
<td width="46" align="right"><input name="go" type="image" value="go" src="/we_site/img/button_go.gif" title="Go" alt="Go" border="0" /></td>
</tr>
</table>
<we:ifNotWebEdition></we:form></we:ifNotWebEdition>
- Code: Alles auswählen
<?php
$GLOBALS["indizes"]=unserialize($GLOBALS["we_doc"]->getElement("ContentBlock"));
$GLOBALS["blockzaehler"] = -1;
?>
<we:block name="ContentBlock">
<?php
$GLOBALS["blockzaehler"]++;
$test="includedblk_ContentBlock_".$GLOBALS["indizes"][$GLOBALS["blockzaehler"]];
$GLOBALS["included"][$GLOBALS["blockzaehler"]]=$GLOBALS["we_doc"]->getElement($test);
?>
<we:ifEditmode>
<we:select name="included" reload="true">
<option value="">Bitte wählen</option>
<option value="1">Teaser mit Bild links</option>
<option value="2">Teaser mit Bild rechts</option>
<option value="3">2 Teaser 2-spaltig</option>
</we:select>
</we:ifEditmode>
<?php if ($GLOBALS["included"][$GLOBALS["blockzaehler"]]==1) { ?>
<table class="teaser_foto" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td><we:img name="contentImage" class="content_bild" xml="true" /></td>
<td width="100%">
<div id="headline_div"><we:input name="subheadline" type="text" size="80" /></div>
<div id="teaser_content_div"><we:textarea name="copytext" wysiwyg="true" size="80" xml="true" commands="anchor,bold,copy,copypaste,createlink,cut,fullscreen,italic,link,paste,redo,subscript,superscript,undo,unlink" /></div>
<we:ifEditmode><div id="weiter_div">[img]we_site/img/pfeil_re2.gif[/img] <we:link name="weiter_link" only="href" /></div><we:else/>
<div id="weiter_div"><a href="<we:link name="weiter_link" only="href" />">[img]we_site/img/pfeil_re2.gif[/img] weiter</a></div></we:ifEditmode>
</td>
</tr>
</table>
<?php } ?>
<?php if ($GLOBALS["included"][$GLOBALS["blockzaehler"]]==2) { ?>
<table class="teaser_foto" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="100%">
<div id="headline_div"><we:input name="subheadline" type="text" size="80" /></div>
<div id="teaser_content_div"><we:textarea name="copytext" wysiwyg="true" size="80" xml="true" commands="anchor,bold,copy,copypaste,createlink,cut,fullscreen,italic,link,paste,redo,subscript,superscript,undo,unlink" /></div>
<we:ifEditmode><div id="weiter_div">[img]we_site/img/pfeil_re2.gif[/img] <we:link name="weiter_link" only="href" /></div><we:else/>
<div id="weiter_div"><a href="<we:link name="weiter_link" only="href" />">[img]we_site/img/pfeil_re2.gif[/img] weiter</a></div></we:ifEditmode>
</td>
<td><we:img name="contentImage" class="content_bild" xml="true" /></td>
</tr>
</table>
<?php } ?>
<?php if ($GLOBALS["included"][$GLOBALS["blockzaehler"]]==3) { ?>
<table class="teaser_foto" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td>
<div id="headline_div"><we:input name="subheadline" type="text" size="40" /></div>
<div id="teaser_content_div"><we:textarea name="copytext" wysiwyg="true" size="40" xml="true" commands="anchor,bold,copy,copypaste,createlink,cut,fullscreen,italic,link,paste,redo,subscript,superscript,undo,unlink" /></div>
<we:ifEditmode><div id="weiter_div">[img]we_site/img/pfeil_re2.gif[/img] <we:link name="weiter_link" only="href" /></div><we:else/>
<div id="weiter_div"><a href="<we:link name="weiter_link" only="href" />">[img]we_site/img/pfeil_re2.gif[/img] weiter</a></div></we:ifEditmode>
</td>
<td width="12"> </td>
<td>
<div id="headline_div"><we:input name="subheadline2" type="text" size="40" /></div>
<div id="teaser_content_div"><we:textarea name="copytext2" wysiwyg="true" size="40" xml="true" commands="anchor,bold,copy,copypaste,createlink,cut,fullscreen,italic,link,paste,redo,subscript,superscript,undo,unlink" /></div>
<we:ifEditmode><div id="weiter_div">[img]we_site/img/pfeil_re2.gif[/img] <we:link name="weiter_link_1" only="href" /></div><we:else/>
<div id="weiter_div"><a href="<we:link name="weiter_link_1" only="href" />">[img]we_site/img/pfeil_re2.gif[/img] weiter</a></div></we:ifEditmode>
</td>
</tr>
</table>
<?php } ?>
<we:ifPosition type="block" position="last" reference="ContentBlock"><we:else />
[img]we_site/img/trenner3.gif[/img]
</we:ifPosition>
</we:block>
Allerdings zeigt sich hier dann auch mein 2tes Problem mit der Suche. Nämlich das die Suche nix findet und anstatt dessen in der Ergebnis-ListView immer in den <we:else />-Bereich von <we:ifSearch> springt. Und das unabhängig davon, ob sich das Suchformular in einer includeten Datei oder der Seite selbst befindet. Der entsprechende Code der Ergebnisseite sieht wie folgt aus.
- Code: Alles auswählen
<we:listview type="search" rows="6" name="suche">
<we:ifSearch>
<we:repeat>
<p>
<we:field name="Title" alt="we_path" hyperlink="true" />
Letzte Änderung: <we:field type="date" name="wedoc_ModDate" format="d.m.Y">
<we:field name="Description" alt="we_text" max="200" />
</p>
</we:repeat>
<we:ifNotFound><h2>Die Suche nach &lquot;<we:search type="print"/>&rquot; ergab leider keine Treffer.</h2><we:else /> </we:ifNotFound>
<we:else /><h2>Bitte starten Sie erst eine Suche.</h2>
</we:ifSearch>
</we:listview>
Gruß,
Matthias