Skip to content

Instantly share code, notes, and snippets.

@GhanshyamBhava
Created January 20, 2021 05:01
Show Gist options
  • Save GhanshyamBhava/995301ad616c873077f8ad68eb336185 to your computer and use it in GitHub Desktop.
Save GhanshyamBhava/995301ad616c873077f8ad68eb336185 to your computer and use it in GitHub Desktop.
Code snippet to add TYPO3 fluid base indexed search for to website header or somewhere in the website according to your preference using typoscript object.
# Fluid Template (Search.html) :
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:form action="search" method="post" action="search" controller="Search" extensionName="indexedsearch" pluginName="pi2" pageUid="5">
<label for="sword">Search: </label>
<f:form.textfield id="sword" name="search[sword]" value="{sword}" class="form-control" />
<f:form.submit name="search[submitButton]" value="Search" />
</f:form>
</html>
# You can use below lib object everywhere in fluid template!
<f:cObject typoscriptObjectPath="lib.navSearch" />
Or
{f:cObject(typoscriptObjectPath: 'lib.navSearch')}
# Typoscript setup :
plugin.tx_indexedsearch {
settings {
displayRules = 0
displayAdvancedSearchLink = 0
}
}
# Create fluid template for search form.
lib.navSearch = FLUIDTEMPLATE
lib.navSearch{
file = EXT:site_builder/Resources/Private/Extensions/Indexed_Search/Search.html
settings.targetPid = 5
variables {
# sword = TEXT
# sword.data= GP:tx_indexedsearch_pi2|search|sword
}
}
# Reference links
- Settings: https://docs.typo3.org/c/typo3/cms-indexed-search/master/en-us/Configuration/TypoScript/Index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment