Open TheJotob opened 5 years ago
Hey @TheJotob
I'm not very into this topic but it should be possible to change the viewClassName
to use FluidTemplates
ext/Configuration/TypoScript/Extensions/Mksearch.setup.typoscript
plugin.tx_mksearch {
searchsolrTemplate = {$path.template.ext}Mksearch/solrSearch.html.twig
searchsolr {
viewClassName = Sys25\RnBase\Fluid\View\Action
}
}
It's also possible use Twig for template rendering. But you have to install another bundle: https://github.com/DMKEBUSINESSGMBH/typo3-t3twig
plugin.tx_mksearch {
searchsolrTemplate = {$path.template.ext}Mksearch/solrSearch.html.twig
searchsolr {
viewClassName = DMK\T3twig\View\RnBaseView
}
}
If you have some future questions @hannesbochmann and @rengaw83 could answer.
Eric
hi @TheJotob,
Eric has already explained it well, thanks eric ;).
At the moment there is no build in fluid template, but we support fluid views.
We will consider to ship mksearch with a standard fluid template in the future.
Here are some detailed information about the fluid views.
mksearch uses rnbase as base library.
the template engine can be changed by typoscript in whatever you want.
rn_base comes with a fluid view you can configure like this:
plugin.tx_mksearch {
view {
templateRootPaths.0 = EXT:my_extension/Resources/Private/Ext/Mksearch/Templates/
partialRootPaths.0 = EXT:my_extension/Resources/Private/Ext/Mksearch/Partials/
layoutRootPaths.0 = EXT:my_extension/Resources/Private/Ext/Mksearch/Layouts/
}
searchsolrTemplate = EXT:my_extension/Resources/Private/Ext/Mksearch/Templates/Search.html
searchsolr {
viewClassName = Sys25\RnBase\Fluid\View\Action
}
}
There are some helpful viewhelpers too. have a look to the docs.
example of Search.html:
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:rn="http://typo3.org/ns/Sys25/RnBase/ViewHelpe"
data-namespace-typo3-fluid="true"
>
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
{namespace rn=Sys25\RnBase\Fluid\ViewHelper}
<form method="GET" id="sitesearch">
<fieldset class="term">
<div>
<input
type="text"
name="mksearch[term]"
value="{term}"
id="mksearch_term"
class="text"
/>
</div>
</fieldset>
<fieldset>
<input
type="hidden"
name="mksearch[submit]"
value="{rn:translate(key : 'label_search_submit')}"
title="{rn:translate(key : 'label_search_submit')}"
class="text"
/>
<input
type="submit"
name="mksearch[submit]"
value="{rn:translate(key : 'label_search_submit')}"
class="submit"
/>
</fieldset>
</form>
<f:if condition="{result.numFound} > 0">
<f:then>
<ul>
<f:for each="{result.items}" as="item" iteration="iterator">
<li>
<h2>{record.title}</h2>
<p>{record.abstract]</p>
<f:switch expression="{item.content_ident_s}">
<f:case value="core.tt_content">
{f:uri.page(pageUid: item.pid, section: item.uid)}
</f:case>
</f:switch>
</li>
</f:for>
</ul>
<f:render partial="PageBrowser" arguments="{_all}" />
</f:then>
</f:if>
I hope that helps at the moment.
best regards
Hello @rengaw83, i tried you suggestion with Elasticsearch and get an error from rn_base. My config is
plugin.tx_mksearch {
view {
templateRootPaths.0 = EXT:my_extension/Resources/Private/ext/mksearch/Templates/
partialRootPaths.0 = EXT:my_extension/Resources/Private/ext/mksearch/Partials/
layoutRootPaths.0 = EXT:my_extension/Resources/Private/ext/mksearch/Layouts/
}
elasticsearchTemplate = EXT:my_extension/Resources/Private/ext/mksearch/Templates/Search.html
elasticsearch {
viewClassName = Sys25\RnBase\Fluid\View\Action
}
}
And when i open the page with the search plugin i get this error:
"Exception": {
"message": "The extension key yould not be resolved. Please check your typoscript configuration.",
"code": 0,
"file": "/var/www/public/typo3conf/ext/rn_base/Classes/Fluid/View/Action.php",
"line": 51,
"trace": "#0 /var/www/public/typo3conf/ext/rn_base/action/class.tx_rnbase_action_BaseIOC.php(107): Sys25\\RnBase\\Fluid\\View\\Action->render('elasticsearch', Object(Tx_Rnbase_Configuration_Processor))\n#1 /var/www/public/typo3conf/ext/rn_base/class.tx_rnbase_controller.php(262): tx_rnbase_action_BaseIOC->execute(Object(Sys25\\RnBase\\Frontend\\Request\\Parameters), Object(Tx_Rnbase_Configuration_Processor))\n#2 /var/www/public/typo3conf/ext/rn_base/class.tx_rnbase_controller.php(233): tx_rnbase_controller->doAction('tx_mksearch_act...', Object(Sys25\\RnBase\\Frontend\\Request\\Parameters), Object(Tx_Rnbase_Configuration_Processor))\n#3 [internal function]: tx_rnbase_controller->main('', Array)\n#4 /var/www/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(5969): call_user_func_array(Array, Array)\n#5 /var/www/public/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php(41): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->callUserFunction('tx_rnbase_contr...', Array, '')\n#6 /var/www/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(815): TYPO3\\CMS\\Frontend\\ContentObject\\UserContentObject->render(Array)\n#7 /var/www/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(731): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->render(Object(TYPO3\\CMS\\Frontend\\ContentObject\\UserContentObject), Array)\n#8 /var/www/public/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3853): TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer->cObjGetSingle('USER', Array)\n#9 /var/www/public/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3814): TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController->INTincScript_process(Array)\n#10 /var/www/public/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3781): TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController->recursivelyReplaceIntPlaceholdersInContent()\n#11 /var/www/public/typo3/sysext/frontend/Classes/Http/RequestHandler.php(187): TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController->INTincScript()\n#12 /var/www/public/typo3/sysext/frontend/Classes/Middleware/OutputCompression.php(46): TYPO3\\CMS\\Frontend\\Http\\RequestHandler->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#13 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\OutputCompression->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(TYPO3\\CMS\\Frontend\\Http\\RequestHandler))\n#14 /var/www/public/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelDataPersister.php(44): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#15 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Adminpanel\\Middleware\\AdminPanelDataPersister->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#16 /var/www/public/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelRenderer.php(46): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#17 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Adminpanel\\Middleware\\AdminPanelRenderer->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#18 /var/www/public/typo3/sysext/frontend/Classes/Middleware/ContentLengthResponseHeader.php(45): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#19 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\ContentLengthResponseHeader->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#20 /var/www/public/typo3/sysext/frontend/Classes/Middleware/ShortcutAndMountPointRedirect.php(65): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#21 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\ShortcutAndMountPointRedirect->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#22 /var/www/public/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php(118): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#23 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\PrepareTypoScriptFrontendRendering->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#24 /var/www/public/typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php(99): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#25 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\PageArgumentValidator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#26 /var/www/public/typo3/sysext/frontend/Classes/Middleware/MaintenanceMode.php(53): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#27 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\MaintenanceMode->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#28 /var/www/public/typo3/sysext/frontend/Classes/Middleware/PageResolver.php(171): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#29 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\PageResolver->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#30 /var/www/public/typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php(62): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#31 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\PreviewSimulator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#32 /var/www/public/typo3/sysext/redirects/Classes/Http/Middleware/RedirectHandler.php(70): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#33 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Redirects\\Http\\Middleware\\RedirectHandler->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#34 /var/www/public/typo3/sysext/frontend/Classes/Middleware/StaticRouteResolver.php(62): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#35 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\StaticRouteResolver->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#36 /var/www/public/typo3/sysext/frontend/Classes/Middleware/SiteBaseRedirectResolver.php(86): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#37 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\SiteBaseRedirectResolver->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#38 /var/www/public/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelInitiator.php(58): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#39 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Adminpanel\\Middleware\\AdminPanelInitiator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#40 /var/www/public/typo3/sysext/frontend/Classes/Middleware/SiteResolver.php(68): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#41 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\SiteResolver->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#42 /var/www/public/typo3/sysext/adminpanel/Classes/Middleware/SqlLogging.php(49): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#43 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Adminpanel\\Middleware\\SqlLogging->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#44 /var/www/public/typo3/sysext/frontend/Classes/Middleware/BackendUserAuthenticator.php(95): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#45 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\BackendUserAuthenticator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#46 /var/www/public/typo3/sysext/frontend/Classes/Middleware/FrontendUserAuthenticator.php(79): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#47 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\FrontendUserAuthenticator->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#48 /var/www/public/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php(90): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#49 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\TypoScriptFrontendInitialization->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#50 /var/www/public/typo3/sysext/frontend/Classes/Middleware/EidHandler.php(50): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#51 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\EidHandler->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#52 /var/www/public/typo3/sysext/frontend/Classes/Middleware/PreprocessRequestHook.php(57): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#53 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\PreprocessRequestHook->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#54 /var/www/public/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php(58): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#55 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Core\\Middleware\\NormalizedParamsAttribute->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#56 /var/www/public/typo3/sysext/frontend/Classes/Middleware/TimeTrackerInitialization.php(49): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#57 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(138): TYPO3\\CMS\\Frontend\\Middleware\\TimeTrackerInitialization->process(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest), Object(class@anonymous))\n#58 /var/www/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php(67): class@anonymous->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#59 /var/www/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(108): TYPO3\\CMS\\Core\\Http\\MiddlewareDispatcher->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#60 /var/www/public/typo3/sysext/frontend/Classes/Http/Application.php(69): TYPO3\\CMS\\Core\\Http\\AbstractApplication->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#61 /var/www/public/typo3/sysext/core/Classes/Http/AbstractApplication.php(120): TYPO3\\CMS\\Frontend\\Http\\Application->handle(Object(TYPO3\\CMS\\Core\\Http\\ServerRequest))\n#62 /var/www/public/index.php(24): TYPO3\\CMS\\Core\\Http\\AbstractApplication->run()\n#63 /var/www/public/index.php(25): {closure}()\n#64 {main}"
},
What have i done wrong?
Looks like the extension key config that is required by the rnbase fluid view is missing. Can you try to add the following typoscript:
plugin.tx_mksearch.extensionKey = mksearch
Great, thank! That was the missing part.
If someone gets this Message (found with MK Logger):
"Classname contains invalid characters or has invalid format: Sys25\\RnBase\\Fluid\\View\\Action".
Change to above mentioned viewClassName = Sys25\RnBase\Fluid\View\Action
to viewClassName = Sys25\RnBase\ExtBaseFluid\View\Action
.
Hi, is there a plan for the future to switch from marker based to fluid based templating? The minimum supported TYPO3 Version is 8.7 so this should not break any backwards compatibility. Maybe this should be in another major version of mksearch though.