TYPO3: category tree of tx-news, render sub-tree only if main is selected - typo3

I override Templates/Styles/TWB/Templates/Category/List.html to have the category menu behave exactly as the sidebar menu in the introduction package (submenus show only if main is selected).
If I add the static template "News Styles Twitter Bootstrap (news)" I'm almost there, it is not difficult to open the sub-categories only if the main category is selected (I need a massive amount of categories/sub-categories), but it should also be open when a sub is selected:
...
<f:if condition="{0:category.item.uid,1:category.item.uid} == {0:overwriteDemand.categories,1:category.children.{overwriteDemand.categories}.parent}">
<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand,class:''}" />
</f:if>
</f:if>
...
I do not know how to use {overwriteDemand.categories} as key to match the value ... can anybody point to the proper syntax
update: I tried to apply a custom ViewHelper as this post suggests, but using TYPO3 V7.6.16 got stuck with the error should be compatible with TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper:‌​:render(), so could not try working with the variable overwriteDemand.categories in another way ...

Dynamic access to variables in fluid is just possible since TYPO3 8. Check out the Whats New Slides here: https://typo3.org/download/release-notes/whats-new/ and search for "Dynamic variable name parts" in the PDF.
In TYPO3 7, the "vhs"-Extension provides a ViewHelper to do the same job but nesting a ViewHelper within an complex f:if-condition is even more difficult. If possible, try out TYPO3 8. If it's not possible you may write your own ViewHelper to solve this logical problem.

Related

Empty cell Typo3 Fluid

Trying to set up a query for the "address list-Plugin" in Typo3.
So if my cell "Title" is written to there would be some information like "Prof.Dr." but if there's no Title on the Entry there should be "-"
Got no code at all at this point because its totally new to me but i assume it would like this a bit:
f:if condition{empty.cell} - or something. Never worked with it till yesterday and can't find any documentation that's helpful about my problem
An introduction to FLUID could be found here
A special hint for beginners:
If you want to know which FLUID variables are defined you can use of the f:debug Viewhelper:
<f:debug title="info at ...">{_all}</f:debug>
The exact syntax for your usage would be:
<f:if condition="{address.title}">
<f:then>{address.title}</f:then>
<f:else>-</f:else>
</f:if>

TYPO3 10.4: tx_news content elements rendering error

I am updating TYPO3 from Version 8 to 9 and 10. Now there is one error, I am not able to find a solution.
In tx_news details view I am using custom fluid templates. In TYPO3 8 and 9 everything works fine. In TYPO3 10.4 I get an error when showing the detail page:
(1/1) #1381512761 TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
Invalid value "FILE" for enumeration "TYPO3\CMS\Core\DataHandling\TableColumnSubType"
If I remove this code for content elements in the fluid template, the page will be shown without errors:
<f:if condition="{newsItem.contentElements}">
<!-- content elements -->
<f:cObject typoscriptObjectPath="lib.tx_news.contentElementRendering">{newsItem.contentElementIdList}</f:cObject>
</f:if>
As I'm using content elements, I need this code.
You can see the error at the moment here:
https://asienhaus104.der-koenig.net/aktuelles/detail/spenden-fuer-die-suedostasien
I tried lots of variants to solve this, but still the error will be there when I insert the fluid output for content elements.
It seems you have a content element inside which is rendered in TypoScript with the FILE object (which was removed in v10). Take a look in your TypoScript (TypoScript object browser is best for this) and search for FILE objects (and replace them).
Here you can find the deprecation notice and a migration suggestion: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/9.5/Deprecation-85970-FileContentObject.html

TYPO3 9.5 Introduction package

How can I get the language selection from the footer into the header area - with introduction-package in TYPO3?
The introduction-package (technically a "TYPO3 distribution") uses the extension bootstrap-package for the layout.
If you have not already you would want to define Fluid paths for overwriting certain templates: https://docs.typo3.org/p/bk2k/bootstrap-package/11.0/en-us/Configuration/TypoScript/Index.html#page-fluidtemplate.
This would add your path to the chain of Fluid directories with highest priority.
To move around the language menu you'll want to change where this partial in included (finding the partial is easy by searching for recognizable HTML-code like IDs):
Partials/Page/Navigation/Language.html
You can include it in your overwritten
Partials/Page/Navigation/Main.html like this:
<f:render partial="Navigation/Language" arguments="{_all}" />
The Partials/Page/Navigation/Main.html is just an example. You can put it where you want. But you have to make sure that the used variable languagenavigation is passed to your partial. That is done by the arguments="...". For the example given this will work because it is itself included from the main Layouts/Page/Default.html and gets also arguments="{_all}".
To learn where languagenavigation comes from have a look at Configuration/TypoScript/setup.typoscript. You'll see it being filled by a DataProcessor inside a 10 = FLUIDTEMPLATE block.
I hope that helps. Feel free to tell us how you fare :) And don't be shy to ask any further questions.

Typo3 change how objects are rendered (typo3 beginner)

I'm fairly new to typo3 and I have an issue that i don't find an explanation on how to change it. I'm sure there are already some helpful tutorials but i have issues finding them.
I am making a website and I have already made a template for fontend and backend.
It is a very simple test template that consists only of one slider and one text element.
The slider is handmade and should have the following layout:
<section class="custom-slider">
<img src="img1.jpg">
<img src="img2.jpg">
...
</section>
Thought easy, i have my slider place in my template, just need to add plain images.
but typo3 gives me:
<section class="custom-slider">
<div id="c3" class="frame frame-default frame-type-image frame-layout-0"><header><h2 class=""></h2></header><div class="ce-image ce-center ce-above"><div class="ce-gallery" data-ce-columns="1" data-ce-images="1"><div class="ce-outer"><div class="ce-inner"><div class="ce-row"><div class="ce-column"><figure class="image"><img class="image-embed-item" src="fileadmin/_processed_/1/2/csm_slider1_c3fdcdcaf5.jpg" width="600" height="187" alt="" /></figure></div></div></div></div></div></div></div>
</section>
Now i search how i can make my own custom elements or render existing elements different. I have found a lot of tutorials but they all are based on 'Extension Builder' or 'Builder' and require a custom extention. These don't seem to work on Typo3 8.7.x. Is there a different solution or can someone give me a good tutorial link?
Thank you in advanst:)
Ps: since i will have the same problem with styled text elements i would like to ask if there is a way to declare in the themplate how different predeterment elements are rendered?
In TYPO3 8.7 (I assume) your rendering is done with FSC (fluid_styled_content), so you have to understand the mechanism of FSC to render a CE (ContentElement).
As the name suggests Fluid is used. Fluid uses different templates organized in three categories (each with it's own folder):
Layouts
Templates
Partials
The call goes to a template (in the folder 'templates') where a tag can be inserted to use a specific layout (from floder 'Layouts'). if this tag is given the rendering starts with the given layout. In the layout different sections and partials can be called. Sections belong to the template, partials need to have an own partial file (in folder 'Partials').
You can override single files from the given declaration to individulize the behaviour.
In your example you may evaluate the field layout in layout, template and partial to avoid the default wrapping of any content (your images) in different div tags.

Typo3: How to disable Bootstrap Language Menu

I installed the latest Typo 3 LTS 7 Version and used Bootstrap with it. I did not enable any multilanguage stuff, nor do I want it to be displayed. How to disable the language ("Deutsch, Dansk, English") which is presented after every footer?
Thanks a lot!
OK, I found a solution.
Just add
page.theme.metasection.enable = 0
to the Template Constants.
This only disables the Language Footer.
I do not know however, how to configure it (i.e. replace the non existing language names like Dansk)
The language menu is being built in EXT:bootstrap_package/Configuration/TypoScript/setup.txt (line 40).
lib.language = COA
lib.language {
...
}
It takes the languages you have defined in the backend (database), assigns information to these and builds up the HMENU. In the default bootstrap_package configuration's case that should be the languages with the ids 0,1,2.
lib.language.20.special.value = 0,1,2
You could change the values there, or get rid of the whole section all together (so not to load it at all) depending on what you want to achieve. If you want to remove it you need to remove the references in the template itself, too.
EXT:bootstrap_package/Resources/Private/Partials/Page/Structure/Footer.html (line 21):
<div class="col-md-4 language">
<f:cObject typoscriptObjectPath="lib.language"/>
</div>
.. and from all other places you are referencing lib.language.