问题
The extension ke_search has a search field plugin that I want to insert into my fluidtemplate and show on every page. I am very new in this and don't know how to start. Any help is appreciated.
回答1:
You can assign the Plugin to an typoscript lib:
lib.searchMask < tt_content.list.20.your_plugin
(Please search the location of the plugin in the typoscript browser)
In your fluid you can use f:cObject
to include it:
<f:cObject typoscriptObjectPath="lib.searchMask" />
回答2:
In general you have three possibilities to include special content in all your pages:
- put the HTML hardcoded in your template (typoscript, marker, fluid)
- use a typoscript object which can be inserted in your template
- use typoscript to render a special CE on a special page
- use a special column in your (BE) page layout, where the content is inherited to subpages
Solution 1 has the drawback of being very static and you might miss the opportunity to configure dynamically (e.g. links, spamprotection, ...)
Solution 2 could be complicated if you want a plugin and the plugin can not be configured by pure typoscript (or the configuration collided with the configuration of the plugin in the main content)
Solution 3 needs a special (unvisible) page where the CE is stored and can be edited. In your TS you render it with the CONTENT object and use a hard coded uid. You need to remember that special place and special CE. (an editor might 'replace' the CE and wonder why it goes missing)
Solution 4 enables you to use 'normal' editor functionality (configure the plugin as a CE), but might cost some more rendering time because of the sliding and you need to define a special column with additional handling.
回答3:
In addition to Bernd's answer, this is the simplest solution using 1) with TypoScript and some constants for the simplest ke_search
input field, but this could be even hardcoded in your html template and it would still work. It's just a GET query that's being sent to the result page – where you set the searchbox again by page plugin.
temp.search = TEXT
temp.search.value (
<form action="index.php" id="site-search" name="xajax_form_kesearch_pi1" id="xajax_form_kesearch_pi1" method="get">
<input type="text" class="search-input" name="tx_kesearch_pi1[sword]" value="">
<input type="submit" value="{$llSearch}" class="button">
<input type="hidden" value="{$pidResultPage}" name="id"><input type="hidden" value="1" name="tx_kesearch_pi1[page]" id="pagenumber">
</form>
)
来源:https://stackoverflow.com/questions/40787318/insert-plugin-into-a-fluid-template