typo3 - prefill search field of indexed search in TYPO3 v9
问题描述
I wonder how I can prefill the search field on the new indexed_search in TYPO3 v9. In older versions i put a searchfield in the head of my site:
<form method="post" action="https//linktomysearchpage" style="margin:0;">
<input type="text" placeholder="Suche" name="tx_indexedsearch[sword]"><span class="site-search-bg">
<button type="submit" name="tx_indexedsearch[submit_button]"><i class="icon-lupe"></i></button>
When jumping from this input field to the search page with the indexed_search plugin the search field of the plugin is filled and a result list is shown.
But in version 9 this does not work anymore. Something has changed. Any help? Thanks!
解决方案
You should not use plain html but rather the fluid templates (templates are now fluid based). Example for integrating a „header search box“ on all pages like this:
lib.searchBox = USER
lib.searchBox {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = TYPO3\CMS
extensionName = IndexedSearch
pluginName = Pi2
switchableControllerActions {
Search {
1 = form
2 = search
}
}
view =< plugin.tx_indexedsearch.view
view {
templateRootPaths {
20 = EXT:sitepackage/Resources/Private/Extension/IndexedSearch/Header/Templates/
}
partialRootPaths {
20 = EXT:sitepackage/Resources/Private/Extension/IndexedSearch/Header/Partials/
}
layoutRootPaths {
20 = EXT:sitepackage/Resources/Private/Extension/IndexedSearch/Header/Layouts/
}
}
settings =< plugin.tx_indexedsearch.settings
}
推荐阅读
- node.js - 在nodejs中合并2个日志文件
- express - 为什么 Morgan Logger 服务器中间件不能在单独的文件中工作?
- javascript - 使用for循环迭代时包含()不匹配字符串
- javascript - 如何自定义融合甘特图?
- google-cloud-platform - GCP:如何修剪/维护工件注册表存储?
- python - 数据框打印仅显示 2 行而不是 20 行
- android - Espresso 测试因以下原因而失败:androidx.test.espresso.AppNotIdleException。以下空闲条件失败 MAIN_LOOPER_HAS_IDLED
- arrays - 优化读取语句
- loopback4 - loopback4 中内置模型的可用性
- c# - 在 Linq Lambda 中转换 mysql