Hallo!
Mit TemplaViola kann man ja diese praktischen Sections anlegen, in der dann viele gleichartige Objekte angelegt werden können. Aber kann man die auch durchnumerieren? Also zB für eine durchlaufende id?
<div id="linkedImage1" class="linkedImage">
<a href="#"><img src="image.png"></a>
</div>
<div id="linkedImage2" class="linkedImage">
<a href="#"><img src="image.png"></a>
</div>
<div id="linkedImage3" class="linkedImage">
<a href="#"><img src="image.png"></a>
</div>
erzeugen? Bislang fällt mir nur ein den Benutzer den Redakteur die Zahlen per Hand im BE eingeben zu lassen.
Einen netten Gruß
SomeBdyElse
Hallo zusammen,
der Beitrag ist zwar schon etwas älter, aber...
hat jemand vielleicht eine Lösung?
Mit folgendem Konstrukt kann man einen Zähler erstellen:
countObj = COA
countObj {
10 = LOAD_REGISTER
10.zaehler.cObject = TEXT
10.zaehler.cObject.data = register:zaehler
10.zaehler.cObject.wrap = |+1
10.zaehler.prioriCalc = intval
20 = TEXT
20.insertData = 1
20.value = {register:zaehler}
}
Dieser wird bei jedem Loop um 1 inkrementiert.
Nun möchte ich gerne zu jedem Abschnitt einen Anker erstellen.
Wie kann ich einem typolink den Wert von {register:zaehler} übergeben -
also etwa:
typolink {
parameter.data = TSFE:id
section = inhalt_{register:zaehler} #???
}
Ich bin für jeden Hinweis dankbar!
Schöne Grüße
Robert
und wieder 3 jahre rum bis zum nächsten beitrag 😃
ich hab das für mein section csc-menu-3 (sitemap for sections) wie folgt gelöst:
tt_content.menu {
# "Section index (pagecontent w/Index checked - liststyle)"
3 {
wrap = <ul class="csc-menu csc-menu-3">|</ul>
select.andWhere = sectionIndex!=0
select.pidInList.override.field = pages
renderObj = COA
renderObj {
10 = LOAD_REGISTER
10.zaehler.cObject = TEXT
10.zaehler.cObject.data = register:zaehler
10.zaehler.cObject.wrap = |+1
10.zaehler.prioriCalc = intval
20 = TEXT
20.fieldRequired = header
20.trim = 1
20.field = header
20.htmlSpecialChars = 1
20.noBlur = 1
#20.wrap = <li class="csc-section">|</li>
20.dataWrap = <li class="csc-section c{field:uid}">|</li>
20.typolink.parameter.field = pid
20.typolink.section.field = uid
20.insertData = 1
20.typolink.ATagParams = class="anchor-{register:zaehler}"
}
}
}
}
Gruß
Das klappt zwar, aber es geht viel einfacher mit: data = register:tx_templavoila_pi1.sectionPos. Die Lösung findet man im Templavoila Handbuch:
Datastructure TypoScript
TemplaVoila offers various special registers to access some context information such as information about the enclosing record, the current field or the section.
tx_templavoila_pi1.parentRec.<field>
Access field data from the database record. See examples below.
tx_templavoila_pi1.current_field
Contains the name of the datastructure field.
tx_templavoila_pi1.nested_fields
Contains the list of all fields your TypoScript is rendered in and provides a way to retriev the context of your rendered element.
tx_templavoila_pi1.sectionPos
Retrieve the current position of your element within a section. See example below.
tx_templavoila_pi1.sectionCount
Retrieve the total amount of elements in the current section. See example below.
tx_templavoila_pi1.sectionIsFirstItem
Determine whether the current element is the first element within the current section.
tx_templavoila_pi1.sectionIsLastItem
Determine whether the current element is the last element within the current section.
Example:
Accessing “parent” record from DS TypoScript
To access “parent” record from “tt_content” or “pages” table in the <TypoScript> section of a field, developer can use special registers. These registers defined only when <TypoScript> section is executed. The following example shows how to use these registers:
10 = TEXT
10.data = register:tx_templavoila_pi1.parentRec.uid
10.wrap = “uid” field of parent record is |