You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3 v8.7.11:如何在所有前端页面侧边栏显示搜索框

Got it, let's get that indexed_search box into your sidebar on every frontend page in TYPO3 v8.7.11. Since you already have the extension installed, here's a straightforward, step-by-step guide to make this happen:

Step 1: Set up a TypoScript object for the search form

First, you need to define a reusable TypoScript object that calls the indexed_search search form. Head to your template's Setup section and add this code:

lib.searchBox = USER
lib.searchBox {
    userFunc = TYPO3\CMS\IndexedSearch\Controller\SearchController->searchFormAction
    # Optional: Uncomment and adjust if you want to use a custom template for styling
    # templateFile = fileadmin/templates/custom_search_form.html
}

This creates a lib.searchBox object that renders the default search form. If you need to tweak the HTML structure for your site's design, uncomment the templateFile line and point it to your own HTML template.

Step 2: Inject the search box into your sidebar

Next, you need to add this object to your sidebar layout. The exact code depends on how your template is structured:

If using a TypoScript-based template:

If your template uses marks (like page.10.marks.sidebar) for the sidebar, add this to your Setup:

# Replace "sidebar" with your actual sidebar mark name
page.10.marks.sidebar < lib.searchBox

# If your sidebar already has content, use += to append instead:
# page.10.marks.sidebar += USER
# page.10.marks.sidebar.10 < lib.searchBox

If using a Fluid template:

Open your sidebar's Fluid template file (e.g., Resources/Private/Partials/Sidebar.html) and add this ViewHelper where you want the search box to appear:

<f:cObject typoscriptObjectPath="lib.searchBox" />
Step 3: Make sure the template applies to all pages

Finally, confirm your template setup is inherited across all pages:

  • Go to the Template module in the TYPO3 backend.
  • Select your root template and check the Include static (from extensions) section—ensure Indexed Search is checked (this loads the extension's base TypoScript).
  • Verify that all child pages are using this root template (or inherit from a template that includes your search box code).
Quick extra tips
  • Styling: The default search form uses the .tx-indexedsearch-form CSS class. Add custom CSS to your site to match your sidebar's design (e.g., adjust input width, button styling).
  • Testing: After setting up, refresh your frontend pages to confirm the search box shows up in the sidebar, and test that searching redirects to the results page correctly.

内容的提问来源于stack exchange,提问作者raj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:16:31