VF DSL 468x60

TS-based Searchbox for Indexed Search

Submitting your vote...
Rating: 4.7 of 5. 10 vote(s).
Click the rating bar to rate this item.

Suppose you want to insert a searchbox on all pages, but don't want to install additional extensions like "macina_searchbox", you can do it all by TS. :)

 

First create a page, and insert the indexed search plugin on that page, and make sure the search are working..

Then insert the code below in your TS setup, and change the value of the constant "plugin.tx_indexedsearch.searchUID" to be the pageID of the page you just created.

 

Setting the "plugin.tx_indexedsearch.showAdvanced=1" will also display a link below the searchbox, which points to the Advanced searchform.

 

Place this in CONSTANTS:

 

plugin.tx_indexedsearch.searchUID = 82
plugin.tx_indexedsearch.showAdvanced = 0

 

 

Place this in SETUP:

 

# --- SEARCHBOX OBJECT ----------------------------------
lib.searchbox = COA_INT
lib.searchbox {
  stdWrap.prefixComment = 2 | lib.searchbox
  10 = TEXT
  10.typolink.parameter = {$plugin.tx_indexedsearch.searchUID}
  10.typolink.returnLast = url
  10.wrap = <div id="indexedsearchbox"><form action="|" method="post" id="indexedsearch"><table cellpadding="0" cellspacing="0" border="0">
  20 = COA
  20 {
    wrap = <tr> | </tr>
    10 = TEXT
    10.data = GPvar : tx_indexedsearch |sword
    10.wrap = <td><input name="tx_indexedsearch[sword]" value="|" class="searchbox-sword" type="text" /></td>
    20 = COA
    20 {
      wrap = <td align="right">&nbsp;|</td>
      10 = TEXT
      10.value = <input type="hidden" name="tx_indexedsearch[sections]" value="0" />
      20 = TEXT
      20.value = <input name="tx_indexedsearch[submit_button]" value="Search" type="hidden" />
      30 = TEXT
      30.value = <input name="search" src="fileadmin/templates/images/search.gif" value="Search" class="searchbox-button" type="image" />
    }
  }
  30 = COA
  30 {
    wrap = <tr>|</tr>
    10 = TEXT
    10.value = Advanced search »
    10.typolink.parameter = {$plugin.tx_indexedsearch.searchUID}
    10.typolink.additionalParams = &tx_indexedsearch[ext]=1
    10.wrap = <td align="right" colspan="2">|</td>
    if.isTrue = {$plugin.tx_indexedsearch.showAdvanced}
  }
  wrap = | </table></form></div>
}

 

 

This snippet was submited by Peter Klein.



Comments


web, 01-11-07 09:59:
How do you place the search box on each page if you are using templavoila?
Goerni, 08-03-08 20:58:
Hello, the Link which is then generated is noch XHTML conform. Can somebody tell me how that works.

The generated HTML Code is like this:

…uche</span><form action="suche.html?&L=0" method="post" id="searchform" name=....

and the Ampersand is invalid.

Maybe someone have the same error.
Marijn, 25-08-08 22:57:
Fantastic! This made my life a whole lot easier, one little COA and my whole website with all of its templates uses the searchfunction. Thank you!
Charley, 06-07-09 23:01:
Same thing slightly changed for tableless design. There is a div class="clearer" to clear any floated elements in the search form if you apply float. If you don't float anything, then you could remove that "clearer" div on the last line:

lib.searchbox = COA_INT
lib.searchbox {
stdWrap.prefixComment = 2 | lib.searchbox
10 = TEXT
10.typolink.parameter = {$plugin.tx_indexedsearch.searchUID}
10.typolink.returnLast = url
10.wrap = <div id="indexedsearchbox"><form action="|" method="post" id="indexedsearch">
20 = COA
20 {
10 = TEXT
10.data = GPvar : tx_indexedsearch |sword
10.wrap = <input name="tx_indexedsearch[sword]" value="|" class="searchbox-sword" type="text" />
20 = COA
20 {
10 = TEXT
10.value = <input type="hidden" name="tx_indexedsearch[sections]" value="0" />
20 = TEXT
20.value = <input name="tx_indexedsearch[submit_button]" value="Search" type="hidden" />
30 = TEXT
30.value = <input name="search" src="fileadmin/templates/images/search.gif" value="Search" class="searchbox-button" type="image" />
}
}
30 = COA
30 {
10 = TEXT
10.value = Advanced search »
10.typolink.parameter = {$plugin.tx_indexedsearch.searchUID}
10.typolink.additionalParams = &tx_indexedsearch[ext]=1
if.isTrue = {$plugin.tx_indexedsearch.showAdvanced}
}
wrap = |</form><div class="clearer">.</div></div>
}

Add comment

* - required field

*



*
*

Top 10 Updates

Creating a simple Infocenter using TYPO3 geändert am  17-Nov-2009 11:12:52
Making the Section Menu work correctly with TemplaVoila geändert am  05-May-2009 10:27:17
Show pages with type "Not in Menu" in a sitemap geändert am  05-May-2009 10:11:17
Implementation of the DHTML menu from brainjar.com  geändert am  01-Feb-2009 13:02:48
Sample DHTML menu geändert am  01-Feb-2009 12:51:25
A introduction to the CONTENT object geändert am  26-Jan-2009 12:20:39
Sample for dynamic image masks geändert am  16-Dec-2008 15:42:32
Useful Links geändert am  11-Dec-2008 10:06:17
Using Transparent PNG's in IE5/6 without JavaScript geändert am  04-Oct-2008 12:27:15
Using lightbox without extension geändert am  13-Jun-2008 14:20:51

Latest comments

23-Feb-2010 04:40:25
Janna schrieb: what about the css? I am still not clear how to link typoscript with the css. Kindly...
Text menu
05-Feb-2010 18:38:50
Martin Terber schrieb: Didn't work for me neither. I will try in TMENU now.
Alternativ sorting for menu items
27-Jan-2010 23:41:31
romx schrieb: U know its dob't work apply to Tmenu))
Alternativ sorting for menu items
Deutsch
Search: