I'm using this bit of Typoscript and a Templavoilà Plus input field to generate some text.
10 = TEXT
10.value.field = field_test
I work with English (default) and German contents. When I translate a content to German, the backend user has to fill in again field_test, which is the normal behaviour.
Modifying the Typoscript, how can I only use the English (default) content of the field_test even in the German content?
Put in other words, how can I get the value of a field of a particular language?
I saw LLL: and l10n_mode, can they be of any help? And if so, how can you use them in that case?
Is it even possible to achieve that with a simple Header of a tt_content?
Or could I use something like that to disable localisation of a single Templavoilà field ?
config.sys_language_softExclude = tt_content:subheader
config.sys_language_softMergeIfNotBlank = tt_content:subheader
The reason why I'm asking this, is because it would be quite useful not to have to fill in again TV fields for links or images for example…
Here is my Typoscript, where field_test is created with Templavoilà and filled in by an backend editor:
5 = IMAGE
5 {
if.isTrue.field = field_test
file = fileadmin/icons/test.png
wrap = <li>|</li>
imageLinkWrap = 1
imageLinkWrap.enable = 1
imageLinkWrap.typolink.parameter.field = field_test
}
I have tried modifying the Data Structure XML as follow, but even though I have no content in the German field_test, it doesn't display the Default/English content.
<meta type="array">
<langDisable>1</langDisable>
<langChildren>1</langChildren>
</meta>
…
<field_test type="array">
<tx_templavoilaplus type="array">
<title>Test</title>
<langOverlayMode>ifBlank</langOverlayMode>
…
</field_test>
A complete guess, maybe insertData = 1 helps out??
5 = IMAGE
5 {
if.isTrue.field = field_test
file = fileadmin/icons/test.png
wrap = <li>|</li>
imageLinkWrap = 1
imageLinkWrap.enable = 1
imageLinkWrap.insertData = 1
imageLinkWrap.typolink.parameter.field = field_test
}
Related
I want to built a content element with fields for text and images (I'm using the Mask extension for this) and use parts of the contents of it on further pages, for example as teasers.
Is it basically possible to put out only parts of a specific record, e.g. only the text and can an anybody give me a hint or an example how to?
Thank you for your help!
Michael
What you are rendering is your selection. In mask you already use only a subselection of all available fields in a tt_content record. It s very complicated for an editor if you use fields in your rendering, that can't be edited.
Assume you have CE (content element) of type A with some fields which all are filled with data, then you change the type to B which has other fields. As you have not emptied the fields from type A you still can access them and render it in the frontend.
if you want to render teaser you use only those fields you think what gives you the teaser information.
In general records are handled complete.
you can define your own viewhelper which provide you with restricted data or you use typoscript where you do the rendering in typoscript and you have no access to individual fields.
e.g. you could use a CONTENT object, selecting data from CEs in another page:
temp.teaser = CONTENT
temp.teaser {
table = tt_content
select {
// assuming context of a page, like in a menu
pidInList.field = uid
orderBy = sorting
max = 1
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.wrap = <div class="head">|</div>
20 = TEXT
20.field = bodytext
20.wrap = <div class="content">|</div>
20.crop = 100 | ... | 1
wrap = <div class="teaser">|</div>
}
}
I have a TYPO3 TypoScript html template and want to show in a single page (called: "competitions"), a list of all competitions with their image and title and this should be links for each of them ('competition'). I have thought to make a page ('competitions') and subpages ('single cmpetition'). I'm not using Fluid actually. How can i get and display those in main page? Or is another way to achieve this ?
depending on your data structure (is the relevant info you want to show stored in the pages record or do you want access tt_content records inside that pages) it is more or less easy.
you always can access the informations with typoscript, but those constructs may get complicated. that means: developing the TS may take some time and the following rendering might also get complex and might take some time.
the easiest way: all information in pages records:
temp.competitions = CONTENT
temp.competitions {
table = pages
select {
pidInList = this
orderBy = sorting
}
renderObj = COA
renderObj {
wrap = <div class="teaser">|</div>
10 = TEXT
10.field = title
10.wrap = <h3>|</h3>
20 = TEXT
20.field = abstract
20.wrap = <div class="abstract">|</div>
30 = IMAGE
:
}
}
It might be a simple solution to that but I am not able to figure it out.
I implement a typo3 6.2.12 website using the bootstrap_package extension. There I have a page with child pages within the page tree. On each child page a comment function should be attached at the end of the main page content. For the comment functionality I use the pw_comments extension, as it is very flexible.
The pw_comments manual shows a possible the integration as follows:
lib.content = COA
lib.content {
10 < styles.content.get
# List comments
20 < lib.pwCommentsIndex
# Write new comment
30 < lib.pwCommentsNew
}
Actually very simple and straightforward.
The bootstrap package extension handles the content as follows (inside base.ts):
lib.dynamicContent = COA
lib.dynamicContent {
5 = LOAD_REGISTER
5 {
colPos.cObject = TEXT
colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
pageUid.cObject = TEXT
pageUid.cObject {
field = pageUid
ifEmpty.data = TSFE:id
}
}
20 < styles.content.get
20.select.where = colPos={register:colPos}
20.select.where.insertData = 1
20.select.pidInList.data = register:pageUid
90 = RESTORE_REGISTER
}
lib.dynamicContentSlide =< lib.dynamicContent
lib.dynamicContentSlide.20.slide = -1
And at that point I have no clue how to integrate pw_comments. In the setup of the plugin I tried this:
[PIDupinRootline = 54]
lib.dynamicContent = COA
lib.dynamicContent {
# List comments
30 < lib.pwCommentsIndex
# Write new comment
31 < lib.pwCommentsNew
}
[end]
The goal of the above is: Attach pw_comments to the main column output to each child page of parent page with uid 54.
Actually it is working but due to the inheritance with lib.dynamicContentSlide =< lib.dynamicContent the comments get also attached each of the 3 footer columns which is not desired behavior.
I could use the plugin extension which is available for pw_comments but that would mean that the editor has always to add that plugin to new child pages when creating them.
I could "hack" the fluid content template files and add a <f:cObject /> tag and call the plugin lib, but I think that solution is odd and .. well .. a hack.
So is there any way how I could attach that plugin to these child pages in a typo script way? I guess it is just a lack of syntax knowledge and yes, typo3 is not my every day job.
Hope anybody can give me a hand on this issue. Thanks so much in advance!
You simple need to replace the reference by a real copy before you add your TypoScript.
lib.dynamicContentSlide < lib.dynamicContent
# your TS goes here
Just repeat all lines with an reference to lib.dynamicContent with a copy operator instead, before you add your modifications to the actual content definition.
using Typo3 6.1, I'd like to be able to add a link with an editable caption to the end of each content element, linking to some related page. My approach was to (mis)use the header_link field for that. I removed the typolink from the headline and added the link after the content.
# something like:
20.text.20.append {
if.isTrue.field = header_link
value = more...
typolink.parameter.field = header_link
wrap = <div class="button">|</div>
}
To be able to use different captions for each link (instead of "more..."), I hoped to use the title property of the typolink since it can easily be set in the backend. Is this possible? Or is there a more reasonable way to achieve this?
The most straightforward way would probably be adding a new link field and a title field for that link by building a custom extension just for that purpose (adding the fields to BE and Database). Then editors can fill in these fields in the same tab and you can access them with typoscript.
You can use COA with new Object
100.value = more
100.wrap = <div class="button">|</div>
100.typolink ...
or use wrapper existing element
stdWrap.typolink {
wrap = <div class="linkwrap">|</div>
parameter.insertData = 1
parameter = {field:header_link}
ATagParams = class="headerLink"
ATagBeforeWrap = 1
}
I'm new to TYPO3 and Fluid and trying to display the page content using a Fluid template similar to the following one:
<div id="content">
<f:format.html>{content}</f:format.html>
</div>
The page data is entered via the backend using a two-column layout (colPos=0, colPos=1).
I am now trying to display the content of the first column (colPos=0) inside the div.
At the moment, my TYPO-Script looks like the following:
page = PAGE
page {
# ...
5 = FLUIDTEMPLATE
5 {
file = fileadmin/templates/default.html
# ...
variables {
pageTitle = TEXT
pageTitle.data = page:title
content = CONTENT
content {
table = tt_content
select {
where=colPos=0
}
renderObj = COA
renderObj {
10 = TEXT
10.field = bodytext
}
}
}
}
It works this way, but I cannot get rid of the feeling that my 5.variables.content is way too complicated.
I saw some solutions using content < styles.content.get as an alternative but using this causes my resulting div to be empty.
Are there any more elegant ways (i.e. shorter in this context) to achieve what I am doing?
On your question which approach is more elegant
(I don't use fluid, but I think it's general Typoscript):
If you want to use css_styled_content, but with more flexibility and transparence than the shortcuts "get", "getLeft" etc., use this:
content < styles.content.get
content.select.where = colPos = 0
No need to specify content = CONTENT in that case.
In the way you wrote it above, you would probably need to add:
10.parseFunc = < lib.parseFunc_RTE
to your renderObj, as else, automatically linked e-Mail addresses etc. won't be rendered in the content.
If you want full control over the markup, your original approach using the CONTENT object is superior to css_styled_content. But you will have to cover each field the editors are supposed to use.
I always use this article: http://www.typo3wizard.com/en/articles/explaining-the-content-object.html
With css_styled_content on the other hand, you get parsing for all fields for free - but also you get all the markup it will write for you.
It might be helpful to look at csc's static template in /typo3/sysext/css_styled_content/static/setup.txt to see what it does.
i dont use fluid, just plain TS for my projects, but i hope ill help.
In backend the cols are like this if u have not "touched" em:
| col1(Left) | col0(Normal) | col2(Right) | col3(Border) |
What i do is this for "normal" layout:
page.10 = TEMPLATE
page.10 {
subparts{
LEFT-CONTENT < styles.content.getLeft
CONTENT < styles.content.get
RIGHT-CONTENT < styles.content.getRight
}
marks {
DESCRIPTION < styles.content.getBorder
}
If u need something more u can use something like this to generate some content that is not on that page and can use it to display it on all pages.
subparts{
LEFT-CONTENT < styles.content.getLeft
LEFT-CONTENT {
select.pidInList = 50
select.where = colPos=0
select.orderBy = sorting
wrap = <div class="col100">|</div>
}
page.5.variables.content < styles.content.get
Of course you must have the CSS styled content extension installed (default) and the static template "CSS Styled content" included in your TypoScript Template (Tab: Includes).
Alternative solution: https://fluidtypo3.org/viewhelpers/vhs/development/Content/RenderViewHelper.html (along with get and random get/render counterparts).