I use TYPO3 v7.6.2!
Create a custom extension.
As the controller can select a template to generate? After the default, select the name_template = name_action.
Thank you, I found the answer to my question.
In order to use different templates for the same extension, you just need to adjust the way in typoscript path to resources on the page where you need to.
Constants:
plugin.tx_plugin {
view {
templateRootPath = fileadmin/tx_plugin/you_custom_template
partialRootPath = fileadmin/tx_plugin/you_custom_partial
layoutRootPath = fileadmin/tx_plugin/you_custom_layout
}
}
and setup:
plugin.tx_plugin {
view {
templateRootPaths.0 = {$plugin.tx_plugin.view.templateRootPath}
partialRootPaths.0 = {$plugin.tx_plugin.view.partialRootPath}
layoutRootPaths.0 = {$plugin.tx_plugin.view.layoutRootPath}
}
}
Related
I want to change the Layout of my Headers in TYPO3. There is a post about this but this but I cant get it to work and that post is 2 years old. With TYPO3 most stuff is outdated quite quickly. This is the post.
Additionally I looked at this article. I know it is in German, maybe it helps anyways.
So I copied the Header.html from the TYPO3 system files, put it in a directory under fileadmin and tried to link to that directory.
fileadmin/.../Partials/Header/Header.html
In the Template setup i added the partialRootPath.
page = PAGE
page {
shortcutIcon = fileadmin/sitedesign/Resources/Private/Templates/Vave/img/Favicon.ico
10 = FLUIDTEMPLATE
10.file = fileadmin/sitedesign/Resources/Private/Templates/Vave/Contact/index.html
10.partialRootPath {
20 = fileadmin/Resources/Private/Partials
}
includeCSS {
contactFile1 = fileadmin/sitedesign/Resources/Private/Templates/Vave/Contact/css/Contact.css
}
}
In Header.html I created an additional case to check if it was working.
<f:case value="7">
<p class="{positionClass}">
<f:link.typolink parameter="{link}">{header}</f:link.typolink>
</p>
</f:case>
I then added that new case in the Page Resources to the TSConfig.
TCEFORM.tt_content.header_layout {
addItems.7 = Name1
}
Changing the content of the Header.html file in the TYPO3 system files works the way I expected it to, so I am quite sure that I understand the basic functionality. The TSConfig part works as well, because I can select "Name1" in the Header Layout Type field.
But no matter what part in the fileadmin Header.html version I change, nothing happens. I checked the path to that Partials folder and the spelling of everything a million times, so I do not think that is the issue either.
Of course I could just change the system file Header.html but that seems wrong on a lot of levels.
Thank you for any help.
Don't mix different usages of fluid!
You want to change the header partial of your content elements.
But you add the new partial to the fluid of page rendering.
if you use FSC (Fluid Styled Content) your additional partial path should go here:
lib.contentElement {
partialRootPaths {
10 = fileadmin/Resources/Private/Partials
}
}
breaking change: lib.contentElementinstead of lib.fluidContent
Additional advices:
be carefull with the names: aside from partialRootPaths there sometimes exist partialRootPath (without s in the end), which is not an object array. That enables you to set only one path (not the usual path list with priority) and which has priority over settings in partialRootPaths if both exist.
separate the different fluid usages!
Give them different paths. There are multiple ways. I prefer:
each extension gets it's own three folders in a folder named for the extension.
And also separate the page rendering and CEs (Content Elements). Your own CEs might be considered as part of the extension 'FSC'.
use a site extension.
All configuration goes into that extension: typoscript, templates, viewhelpers, TCA, ...
That is the basic configuration for that site, but also the additional configuration/ adaption for the used extensions.
May this code will help you!!
page = PAGE
page {
shortcutIcon = fileadmin/sitedesign/Resources/Private/Templates/Vave/img/Favicon.ico
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName {
cObject = TEXT
cObject {
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
required = 1
case = uppercamelcase
split {
token = pagets__
cObjNum = 1
1.current = 1
}
}
ifEmpty = Innenseite
}
#templateName=TEXT
# templateName.value=index
layoutRootPaths {
20 = your layoutRootPaths
}
partialRootPaths {
20 = your partialRootPath
}
templateRootPaths {
20 = your templateRootPath
}
}
includeCSS {
contactFile1 = fileadmin/sitedesign/Resources/Private/Templates/Vave/Contact/css/Contact.css
}
}
Make sure header included properly in main template
I need to hide the more link in the news_list when cropMaxCharacters exceed the maximum characters in a news.
Is it possible via typoscript template setup?
This is my typoscript template for the news page.
plugin.tx_news.settings {
startingpoint = 128
list.paginate.itemsPerPage = 10
cropMaxCharacters = 9999
}
lib.news = USER
lib.news {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Pi1
vendorName = GeorgRinger
extensionName = News
controller = News
settings =< plugin.tx_news.settings
persistence =< plugin.tx_news.persistence
view =< plugin.tx_news.view
}
lib.news_list < lib.news
lib.news_list {
action = list
switchableControllerActions.News.1 = list
}
lib.news_detail < lib.news
lib.news_detail {
action = detail
switchableControllerActions.News.1 = detail
}
[globalVar = GP:tx_news_pi1|news > 0]
page.100.10.20 = COA
page.100.10.20.10 < lib.news_detail
[else]
page.100.10.20 = COA
page.100.10.20.10 < lib.news_list
[end]
cropMaxCharacters is set that heigh, because i want to have all news with their complete text.
If there is a way to show all news on one page in detailed view i'd be interested in that, too.
Your wishes can come true. but not so much with typoscript but with fluid.
As other extensions ext:news uses fluid templates which can be selectively(!) been replaced.
First add your pathes to the rootpathes:
plugin.tx_news {
view {
layoutRootPaths.10 = EXT:site_ext/Resources/Private/news/Layouts
partialRootPaths.10 = EXT:site_ext/Resources/Private/news/Partials
templateRootPaths.10 = EXT:site_ext/Resources/Private/news/Templates
}
}
This will define alternative pathes for templates.
Now you need to copy the original Templates you want to modify from the subdir in the news extension into your folders.
Then you need to modify the templates.
The template for the list view could be found with the path Templates/News/List.html. the single news are rendered in the partial partial/List/Item.html. There you can find the usage of the viewhelper f:format.crop and the more link (look for the text "more-link")
If you want a complete listing of all news with full text you could replace the item partial with a copy of the template from the detail-view.
I try to create an TYPO3 extension with multiple Plugins in TYPO3 8.7 using EXTBASE (With and without Extensionbuilder).
I don't understand why, but the following TypoScript doesn't work:
(Error no Template found...)
plugin.tx_test_pi1 {
view {
templateRootPaths.0 = EXT:test/Resources/Private/Templates/
...
}
plugin.tx_test_pi2 {
view {
templateRootPaths.0 = EXT:test/Resources/Private/Templates/
}
However, if I made the following changes all PlugIn's will work:
plugin.tx_test {
view {
templateRootPaths.0 = EXT:test/Resources/Private/Templates/
}
What I'm missing?
Extbase uses the general TypoScript configuration. The plugins are not separated any more by classes. You can use three plugins and only one controller.
Maybe have a look at this page: https://docs.typo3.org/typo3cms/ExtbaseFluidBook/4-FirstExtension/7-configuring-the-plugin.html
TYPO3 7.6.15
Powermail 3.18.0
The date picker field does not open the popup calendar. I have narrowed down the cause being because the necessary CSS files are not being included for this feature. Is there an error in my setup? How do I have them included automatically?
This is what I have in my TS Setup:
plugin.tx_powermail {
view {
templateRootPaths >
templateRootPaths {
0 = {$plugin.tx_powermail.view.templateRootPath}
1 = fileadmin/template/mysite/powermail/Templates/
}
partialRootPaths >
partialRootPaths {
0 = {$plugin.tx_powermail.view.partialRootPath}
1 = fileadmin/template/mysite/powermail/Partials/
}
layoutRootPaths >
layoutRootPaths {
0 = {$plugin.tx_powermail.view.layoutRootPath}
1 = fileadmin/template/mysite/powermail/Layouts/
}
}
_LOCAL_LANG.default {
datepicker_format_date = d/m/Y
datepicker_format_time = H:i
datepicker_format_datetime = d/m/Y H:i
}
}
The only way I have found to make it work correctly is by manually adding it like this:
page.includeCSS {
file4 = EXT:powermail/Resources/Public/Css/Basic.css
}
in the Documentation ist a hint:
https://docs.typo3.org/typo3cms/extensions/powermail/ForAdministrators/Installation/Index.html#addbootstrapclassesandcsstopowermail
you should
add the static template Add classes and CSS based on bootstrap (powermail)
There the css is included
You need to tell powermail to load the JavaScript libraries by setting a constant in your TypoScript template:
plugin.tx_powermail.settings.javascript.addAdditionalJavaScript = 1
See https://docs.typo3.org/typo3cms/extensions/powermail/Faq/Index.html#datetimepickernotworking for more information.
Adding the static template file would result in a TypoScript like
plugin.tx_powermail.settings.BasicCss
=EXT:powermail/Resources/Public/Css/Basic.css
this should load everything.
The datepicker styles are originally located in https://github.com/einpraegsam/powermail/blob/develop/Resources/Private/Sass/_DatePicker.scss
I would like to add a custom class to the wrap of the whole output of a custom plugin. fluid_styled_content generates the <div id="c55"> tag. There I would like to add the custom class defined in the flexform of the plugin.
Do I have to override the file HeaderContentFooter.html of the fluid_styled_content package or is there a different solution for that problem. If I override that file I can't access the flexform values of the plugin.
I'm thankful for every help.
Cheers
To copy the layout to your own template folder, this is the best approach to solve this :
I am not sure, why you can't access to the plugin settings.
Create a template extension (sitepackage):
copy the file
typo3conf/ext/sitepackage/Resources/Private/Fluid/Content/Layouts/HeaderContentFooter.html
add this to TypoScript:
plugin.tx_sitepackage {
view {
templateRootPaths.0 = EXT:sitepackage/Resources/Private/Templates/
partialRootPaths.0 = EXT:sitepackage/Resources/Private/Partials/
layoutRootPaths.0 = EXT:sitepackage/Resources/Private/Layouts/
}
}
add something like this to HeaderContentFooter.html
{namespace css=Vendor\Sitepackage\ViewHelpers}
and to render the CSS class
{css:getclass()}
Create a Viewhelper in
sitepackage/Classes/ViewHelpers/getclass.php
with something like this inside:
namespace Vendor\Sitepackage\viewhelper ;
class getclassViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
public function render() {
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
$settings = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT );
return $settings['FlexFormfieldName'] ;
}
}
Not tested Completely but should do so