TYPO3 - Markup using Math - typo3

So lets say I have something like this:
20 = CONTENT
20{
table = tt_content
select{
pidInList = 1
where = colPos = 0
}
renderObj = COA
renderObj{
wrap = <div class="normal">|</div>
10 = TEXT
10{
field = bodytext
}
}
}
and I want that every third object changes the class "normal" by "special". How could I do such operation in Typoscript?

Use optionSplit (DE) for this task on the wrap value, you need abcabc pattern where a,b = normal, c = special, so most probably it will be something like this:
wrap = a||b||c |*| a||b||c
Wrote it from top of my head so you need to check it.

Related

Typo3 Breadcrumb with stdWrap.data possible?

I am new to Typo3 and wanted to have something like this: date / page1 > page2 > page3...
I know how to make a simple breadcrumb but now I wonder how I can put the current date in front of it. When I try the stdWrap.data + stdWrap.dataWrap the breadcrumb doesn't show.
20 = HMENU
20 {
special = rootline
special.range = 0 | -1
stdWrap.data = date : d.m.Y :::
stdWrap.dataWrap = <p> | </p>
//wrap = <p> | </p>
1 = TMENU
1 {
NO = 1
NO.allWrap = | >
CUR = 1
CUR.allWrap = |
}
}
Currently I don't know if I had to write to objects in typoscript for it or if I could do it in once like I tried. Maybe you can hint me to something or explain a simple way. Thanks!
You need to do a proper wrapping.
20.stdWrap.data
is no wrap at all and will be ignored so you might only get an empty p-tag from the stdWrap.dataWrap.
Following your attempt I think you want something like:
20.dataWrap = <p>{date:d.m.Y}</p> |
so I don't get it why you use a p tag to get all in one line.
I would propose a different TypoScript:
lib.breadcrumb = COA
lib.breadcrumb {
stdWrap.wrap = <ul>|</ul>
10 = TEXT
10 {
wrap = <li>|</li>
data = date : U
strftime = %A, %e. %B %Y
}
20 = HMENU
20 ... your TS for the breadcrumb menu
}

Typo3/Typoscript : Content select, keep breaklines

This is my (very simple) code :
table = my_table
select.selectFields = teaser
renderObj = COA_INT
renderObj {
10 = TEXT
10.field = teaser
}
In fact a breakline is present in the teaser field (visibile in phpMyAdmin) but my code doesn't keep it. Is there a way to keep it when rendering the text via renderObj ?
Thanks for your help !
If you need breaklines in HTML you can use the br function in TypoScript. See: https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Stdwrap/Index.html?highlight=nl2br#br
10 = TEXT
10.field = teaser
10.br = 1

TYPO3 ignores Language in categories select

I am selecting categories on an English page. The categories have the language ID 0. English is ID 1.
But I need the same categories on both languages.
cheese = CONTENT
cheese {
wrap = <cheese_legend>|</cheese_legend>
table = sys_category
select {
pidInList = {$categories}
selectFields = *
where = deleted = 0
andWhere = sys_language_uid = 0
andWhere = hidden = 0
}
renderObj = COA
renderObj {
wrap = <cat>|</cat>
10 = TEXT
10 {
stdWrap.field = uid
stdWrap.wrap = <div>|</div>
}
20 = TEXT
20 {
stdWrap.field = title
stdWrap.wrap = <div>|</div>
}
30 = TEXT
30 {
stdWrap.field = sys_language_uid
stdWrap.wrap = <div>|</div>
}
}
}
So I'm explicitly selecting the sys_language_uid = 0!!
But nevertheless the script only gives me results with the ID = 1.
Any idea to make this baby work?
You have doubled the andWhere = statement, so the one below overwrites the one above.
Use andWhere = sys_language_uid = 0 AND hidden = 0 in one line.
For getting the english ones you use andWhere = sys_language_uid = 1 AND hidden = 0.

Typoscript Use value in Text Wrap multiple times

In a Templavoila FCE i want to achieve the following from an input field:
<a name="Inputvalue">Inputvalue</>
My current Setup is the following:
10 = TEXT
10.current = 1
10.wrap = <a name="|"> | </a>
But for sure, it just fill out the first pipe:
<a name="Inputvalue"></a>
Any Idea how to achieve that in a simple way?
Got it!
I did it this way:
10 = COA
10 {
wrap = |
10 = TEXT
10.current = 1
10.rawUrlEncode = 1
10.wrap = <a name="|">
20 = TEXT
20.current = 1
20.wrap = | </a>
}

Typoscript - Splitting "media" and "imagecaption" simultaneously

I have made a plugin where I store many images in the "media" field and jsut as many captions in the field "imagecaption".
Now my wish is to display it like this:
image1.png
caption 1
image2.png
caption 2
image3.png
caption 3
This is how ive been trying to do it, but its not working:
plugin.tx_myplugin_pi1 = COA
plugin.tx_myplugin_pi1{
10 = TEXT
10.field = header
10.wrap = <h1>|</h1>
20 = COA
20{
10 = TEXT
10{
field = media
split{
token = ,
cObjNum = 1
1.current = 1
}
}
20 = TEXT
20{
field = imagecaption
split{
token.char = 10
cObjNum = 1
1.current = 1
}
}
}
}
But its not really working, as it shows first all the filenames and then the caption.
How could I do it?
Split is a function which returns all elements. Within 20.10 you get the content of field image, splitted by an newline f.e. and after that, you get the content of 20.20 which has the imagecaption.
What you need to do (untested):
10 = TEXT
10{
field = media
split{
token = ,
cObjNum = 1
1.current = 1
# for each image, add the imagecaption
1.append = TEXT
1.append {
field = imagecaption
# split saves the index in REGISTER:SPLIT_COUNT
listNum.stdWrap.data = REGISTER:SPLIT_COUNT
listNum.splitChar = 10
}
}
}
I do not think that token = \n is correct. You properly need to use .char = 10.
Also you will need to nest your TS somehow, because the current solution does handle the fields one by one.
I can't remember at the moment but I've wrote an extension that adds a frame to a picture and caption. It can solve your problem with the captions: http://typo3.org/extensions/repository/view/ch_imgtext_renderengine/current/.