TYPO3 CASE with Templavoilà FCE id - typo3

Is it possible to access the id of a Templavoilà Data Structure / FCE for a CASE ?
I tried this which didn't work :
10 = CASE
10 {
key.field = tx_templavoilaplus_datastructure
100 = TEXT
…
default = TEXT
…
}
Thank you ! =)

The field for the Data Structure in tt_content for TemplaVoila is tx_templavoila_ds. If you're using TemplaVoila Plus it's tx_templavoilaplus_ds.
Also, only the fields in the data structure are available directly. However, TemplaVoila loads the parent record data in the register. You can access it using key.data = register:tx_templavoila_pi1.parentRec.tx_templavoila_ds. For TemplaVoila Plus it's key.data = register:tx_templavoilaplus_pi1.parentRec.tx_templavoilaplus_ds

Related

Get tx_news fal_media via TypoScript to use in fluid page template

I want to use the first image out of a new entry to include in the page header.
Therefore i need the news fal_media data in TypoScript to pass it to my page fluid template.
I managed to get the first image as a file path by this TypoScript code:
lib.newsimage = FILES
lib.newsimage {
references {
table = tx_news_domain_model_news
uid.data = GP:tx_news_pi1|news
fieldName = fal_media
}
maxItems = 1
renderObj = IMG_RESOURCE
renderObj.file {
import.data = file:current:publicUrl
}
stdWrap.ifEmpty = {$settings.ext.news.imageDummy}
}
But is there a better way to do it, especially to get the data as an array of FileReferences? With a FAL FileReference i could also take crop an meta data into account.
You might use a FilesProcessor
example based on the manual:
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
as = news_images
references {
fieldName = fal_media
table = tx_news_domain_model_news
}
sorting = datetime
sorting.direction = descending
}
Although I can't imagine that this will be the correct way as there is no guarantee that the first news you select by this is the first news shown on the page. News have multiple conditions to be shown aside of basic visibility: ordering by publishing time, archived state, top-news state, groups or categories, ...
Maybe it would be easier if you use a news plugin with a special template and don't forget to enable showing of news multiple times (by default each news gets shown only once in a page)

TYPO3/Typoscript : render sql query as array

I am using TYPO3 6.2.
On my website, i make a SQL query this way :
lib.bloc_top = COA
lib.bloc_top.10 < styles.content.get
lib.bloc_top.10.select.selectFields = header
lib.bloc_top.10.select.where = ( deleted = 0 && hidden = 0 && tx_gridelements_container = 2571 && CType = 'header' )
All works but instead of outputting the results as HTML code, I would like to render it in an array that I would use in my FLUID template this way :
<f:for each="{car}" as="el">
<li>Brand : {el}</li>
</f:for>
Is it possible ?
Thanks for your help :)
You should not select the container by a specific UID, but create a "car" container type via Gridelements CE backend layout instead.
Anyway, to get the data into an array, you don't have to do anything special, since this is automatically done by styles.content.get under the hood.
While styles.content.get uses the default tt_content setup, you can change that via renderObj as described here: https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/ContentObjects/Content/
To get the data into your Fluid template you just have to replace the default renderObj with a FLUIDTEMPLATE https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/ContentObjects/Fluidtemplate/Index.html
lib.bloc_top.10.renderObj = FLUIDTEMPLATE
lib.bloc_top.10.renderObj {
file = path/to/your/template/file.html
}
Since the loop is handled by the CONTENT object of styles.content.get, you can skip the f:for part in your template though.
Usually any kind of data is provided within the cObj->data array, so something like <h1>{data.header}</h1> should do the job.
And even with CONTENT there should be a counter, since there is https://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#cobj
To get any available data you should use <f:debug>{_all}</f:debug> in your Fluid template.

Custom Content Element with IRRE via Typoscript -> empty array

i have a little problem getting a custom content element via typoscript on all pages.
i´ve created a custom element without any extensions (like mask or dce) so im only using
TYPO3 core functions. This Element is a simple thingy that just uses irre for creating
different boxes to be displayed in the frontend.
tt_content.box = COA
tt_content.box {
10 = FLUIDTEMPLATE
10 {
file = EXT:xxx_elements/Resources/Private/Templates/Box.html
partialRootPath = EXT:xxx_setup/Resources/Private/Content/Partials
layoutRootPath = EXT:xxx_setup/Resources/Private/Content/Layouts
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tx_xxxelements_box
orderBy = sorting
where {
data = field:uid
intval = 1
wrap = tt_content=|
}
as = boxitems
}
}
}
}
rendered with normal fluid like
<f:for each="{boxitems}" as="boxitem">
<boxitem.header>...
</f:for>
so everything works fine as long as i use it as a regular content element that is placed
on a page. now i put one element into a storagefolder and try to reuse this element on all pages via typoscript
where 10 is the ID of the content element
lib.SubFooter = COA
lib.SubFooter {
10 = RECORDS
10 {
tables = tt_content
source = 10
}
}
the lib is rendered correct, but the "boxitems" array is empty on all pages :-(
now the funny part:
if i place the element with ID 10 on a page the boxitems array is filled for both element and lib...
Here is an image with the variable dump for different situations:
element, lib, element+lib
Unfortunately, I could not find a satisfactory solution to the problem. In the end, I have built the content element as a normal element instead of IRRE, then the integration with typoscript works as expected.
maybe you're missing the pid ;-)
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
....
pidInList.field = pid
and you can simplify in my opinion in this case the where clause:
where.dataWrap = tt_content={field:uid}
because you're not matching against vars from outside...

Build HMENU with Information from TCE

I have extended the TCA for every Backend-Page on the Page-Tree. One of the new Options is the "Page-Type", for example "PressPage". With this Extension, i have a new databasefield in the table "pages".
Now i would build an HMENU/TMENU with all pages, below this folder.
[...]
lib.MetaPressNavigation{
special = directory
special.value = ID_FROM_FOLDER_WITH_PAGETYPE_PRESSPAGE
[...]
But i have no idea to realize them with typoscript.
I hope anyone can help me.
Thanks.
EDIT:
Now - i have try it with an extended TCA. It's very easy for any User to make some configuration for this projectpage. The Users can set a value with an Checkbox in a special tab.
I have try to get the page out form the database, with this special config - any page have in the database on the column "tx_meta_pagetype the value 9. I need the UID from this page to build the META-Navigation. It will be full functional - when i give a hardcoded uid, but i need this dynamic.
This is my attemp, to get the UID from the database:
temp.MetaNavigationIds = CONTENT
temp.MetaNavigationIds{
table = pages
select.Where = tx_meta_pagetype = 9 #tx_meta_pagetype is set from the TCA
renderObj = TEXT
renderObj.field = uid
renderObj.stdWrap = |
}
lib.MetaNavigation = HMENU
lib.MetaNavigation{
special = directory
special.value < temp.MetaNavigationIds #the UID of configured page, that i need for the menu
1 = TMENU
1 {
wrap = <ul> | </ul>
NO{
wrapItemAndSub = <li> | </i>
wrapItemAndSub.insertData = 1
allStdWrap.insertData = 1
}
}
}
I have try a lot of database question with typoscript, but nothing works.
Be careful, special.value is not a content object but just a property. You are copying a content object (CONTENT) in its place. This does not work.
However it does have stdWrap. Therefore something like
special.value.stdWrap.cObject < temp.MetaNavigationIds
Should work out.
For renderObj.stdWrap = | enter renderObj.wrap = |, instead. Please mind the trailing comma. This will make sure that you actually get a comma separated list of uids. Otherwise your uids would be printed just after each other, thus forming one big number.
Please test each part individually before adding the components together. You should make sure that each pease returns the correct data, otherwise you will never get a working solution.
And of course select.Where must be select.where. Capitalization does matter.
Here is a working example for CONTENT:
page.10 = CONTENT
page.10 {
table = pages
select {
where = doktype = 199
recursive = 99
# Needs to be your root page uid
pidInList = 1
}
renderObj = TEXT
renderObj.field = uid
renderObj.wrap = |,
}
If you are using TYPO3 6.2, I would recommend to use the new category system. You can create different categories in the TYPO3 backend and assign those categories to your pages.
With this, you can create a HMENU/TMENU like shown below:
20 = HMENU
20 {
special = categories
special.value = 1,2
1 = TMENU
1.NO {
...
}
}
If you do not use TYPO3 6.2 or do not want to use the category system, you can use a userfunction to return the pages which matches your "Page-Type".
HMENU/TMENU TypoScript will be like shown below.
lib.leftmenu.20 = HMENU
lib.leftmenu.20.special = userfunction
lib.leftmenu.20.special.userFunc = user_myspecialmenu_pi1->getPressPages
The TypoScript above is just an example, and you need to code the userfunction your own.
A detailed reference of the special property userfunction is available here and a example can be found here.

TYPO3 language translation bug

I'm having this wierd bug wherein a content is fetched twice
#Page Content
10 = RECORDS
10.source.current=1
10.tables = tt_content
10.stdWrap.required = 1
10.wrap = |
#Alternate content is fetched from page 36 if page content not present
10.stdWrap.ifEmpty.cObject = CONTENT
10.stdWrap.ifEmpty.cObject {
table = tt_content
select.pidInList = 36
}
All these works fine except when I translate the page.
The issue is, only in my alternate language, this alternate content is fetched twice.
The translation works fine for normal content. If the user hasn't provided content, a default set has to be fetched. My 'Page Content' is empty in this example, so alternate content is fetched once, whereas in the second language, it is fetched twice.
Btw, this typoscript is written within the XML of the TemplaVoila template.
Any ideas guys?
I have managed to fix this issue by creating a new content in the alternate language, instead of translating the original content.
When a translated content is called via this method, it is not handled well by TemplaVoila. Then again, maybe it was not designed to do so.
I just came across this issue, I am using the CONTENT module instead of RECORDS (in your example above).
The solution for me was that I was missing the select.languageField line:
10 = CONTENT
10.table = tt_content
10 {
select.where = colPos = 0
select.pidInList = 47
select.orderBy = sorting
select.languageField = sys_language_uid
}
Cheers