---
title: "Sectionelemente Nummerieren"
url: "https://www.typo3.net/d/52709-sectionelemente-nummerieren"
source: "typo3.net"
tags: ["Archiv","TemplaVoilà","Frage"]
created: "2006-11-02"
last_reply: "2012-12-01"
replies: 3
solved: false
page: 1
pages: 1
lang: "de"
---

# Sectionelemente Nummerieren

Archiv › TemplaVoilà · 3 Antworten · gestartet 2006-11-02

## Eröffnungsbeitrag

**SomeBdyElse** · 2006-11-02 · [Beitrag #1](https://www.typo3.net/d/52709-sectionelemente-nummerieren/1)

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?

```html
<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

## Antworten

### [#2](https://www.typo3.net/d/52709-sectionelemente-nummerieren/2) · RobertP · 2009-01-09

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:

```typoscript
 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:

```typoscript
typolink {
  parameter.data = TSFE:id 
  section = inhalt_{register:zaehler} #???
}
```

Ich bin für jeden Hinweis dankbar!

Schöne Grüße
Robert

### [#3](https://www.typo3.net/d/52709-sectionelemente-nummerieren/3) · InforMedic · 2012-11-26

und wieder 3 jahre rum bis zum nächsten beitrag :D

ich hab das für mein section csc-menu-3 (sitemap for sections) wie folgt gelöst:

```typoscript
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ß

### [#4](https://www.typo3.net/d/52709-sectionelemente-nummerieren/4) · Gernott · 2012-12-01

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:

```typoscript
10 = TEXT
10.data = register:tx_templavoila_pi1.parentRec.uid
10.wrap = “uid” field of parent record is |
```

---

Quelle: „Sectionelemente Nummerieren“, typo3.net, https://www.typo3.net/d/52709-sectionelemente-nummerieren
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
