« December 2009»
S M T W T F S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

[blog...]

20.12.2009
20:02

Add Searchbox for Indexed Search to Typo3 Page

Screenshot Searchbox on weltcafe-dresden.de
Searchbox on weltcafe-dresden.de

I started now to add the Typo3 indexed search to some of my websites.

 

But how to add a searchbox on top of the website? There are several extensions for this, but some simple TypoScript is sufficiant. The following code in my template generates such a box (see on top of this page). The style is done of course by CSS.

 

temp.searchbox >
temp.searchbox = COA
temp.searchbox {

 

 

  20 = TEXT
  # pid of page including index_search plugin
  20.typolink.parameter = 46
  20.typolink.returnLast = url
  20.wrap = <form action="|" method="post"><span>

 

 

 

 

  30 = TEXT
  30.value = <input name="tx_indexedsearch[sword]" value="Search item..." \
type="text" title="Search the homepage." onfocus="javascript:this.value=''" />

 

 

 

 

  40 = TEXT
  40.value = <input name="submit" value="Search" type="submit" class="submit" />

 

 

 

 

  50 = TEXT
  50.value = </span></form>

 

 

  wrap = <div class="absearchbox">|</div>

 

 

}

 

 

 

 

page.10.subparts.SEARCHBOX < temp.searchbox

 

 

 

On a multilanguage site like www.weltcafe-dresden.de you can add a simple language switch like the following for German (L=0, Default) and English (L=1):

 

[globalVar = GP:L = 1]

 

 

temp.searchbox {

 

 

  30.value = <input name="tx_indexedsearch[sword]" value="Search item..." \
type="text" title="Search the weltcafe-dresden homepage." onfocus="javascript:this.value=''" />
  40.value = <input name="submit" value="Search" type="submit" class="submit" />

 

 

}

 

 

[else]

 

 

temp.searchbox {

 

 

  30.value = <input name="tx_indexedsearch[sword]" value="Suchbegriff..." \
type="text" title="Durchsuchen Sie die weltcafe-dresden Seite." onfocus="javascript:this.value=''" />
  40.value = <input name="submit" value="Suchen" type="submit" class="submit" />

 

 

}

 

 

[end]
Alexander Bigga
Tags: typo3, search
Views: 298
  •  
  • 0 Comment(s)
  •  

Your comment

Notify me when someone adds another comment to this post

back

[ 29.01.2012 ]