Zum Inhalt springen

Dynamisches ändern von GIFBUILDER Ergebnis bei Sub-/Templates

Erstellt am 14. Juni 2006 · 4 Antworten · letzte Antwort am 14. Juni 2006

Tags: Frage

MrBlaschke ·

Hallo *

Ich habe ein externes HTML Layout in meine Seite integriert.
Funktioniert auch einwandfrei.

Bin gerade beim erlernen von dynamisch hinzugefügten Inhalten und komme da grad nicht weiter.
Im Forum habe ich ein paar Ansätze gefunden welche aber nicht kompatibel zu meinem Ansatz waren.

RootLevel hat das HTML Template und dieses vererbt auf seine Unterknoten. - Funktioniert.

RootLevel bekommt ein GIFBUILDER Image mittels:

	subparts.TRAILER = IMAGE
	subparts.TRAILER.file = GIFBUILDER
	subparts.TRAILER.file {
		XY = 262, 101
		backColor = #34a4e4
		10 = TEXT
		10.text = Andere Grafik !!
		10.fontSize = 19
		10.fontFile = fileadmin/template/fonts/arial.ttf
		10.fontColor = #000000
		10.niceText = 1
		10.offset = 10, 60
		10.angle = 15
	}

Dieses ist im Hauttemplate (temp.mainTemplate = TEMPLATE)
mit page.10 < temp.mainTemplate eingebunden. - Funktioniert

Auf einer der Unterseiten habe ich ein ext+ Template angelegt:

page = PAGE
page {
	typeNum = 0
	#bodyTag = <body bgColor="#DDDDDD">

	20.marks {
		TRAILER = IMAGE
		TRAILER.file = GIFBUILDER
		TRAILER.file {
			XY = 262, 101
			backColor = #82BC8B
			10 = TEXT
			#10.textMaxLength= 10
			10.text = Ich bin eine echtzeitgenerierte Grafik!!
			10.fontSize = 13
			10.fontFile = fileadmin/template/fonts/arial.ttf
			10.fontColor = #000000
			10.niceText = 1
			10.offset = 10, 30
			10.angle = -15
		}
	}

}

Dies wird aber nur angezeigt wenn ich den GIFBUILDER aus dem Haupttemplate entferne.
Momentan sieht es so aus das immer das Bild aus dem Haupttemplate erscheint.

Ich vermute das die ext+ Templates vor den Hauttemplates eingebunden werden und dieses deshalb in dieser Unterseite überschrieben wird. Ob dem tatsächlich so ist weiss ich allerdings nicht.

Was ist falsch in meinem Ansatz ?

Kurz gesagt: Ich möchte in einem Bereich (###TRAILER###) auf diversen Unterseiten ein anderes GIFBUILDER Ergebnisbild einbinden als im Templateroot angegeben ist.

EDIT:
Ich möchte in diesem Fall den Weg über den GIFBUILDER gehen und nicht mit Resourcen arbeiten.

Gruß,
MrBlaschke (Frank)

Unbekannter Benutzer ·

ext templates werden nicht vor dem Haupttemplate eingebunden sondern unterhalb. Du hast aber relativ viel neu definiert ich vermute daher kommen die Probleme. In extension templates nur das jeweilige Seitenobjekt definieren das Du neu oder geändert haben möchtest, nicht wieder anfangen mit page = PAGE, typeNum etc..

Dabei aber den vollständigen Objektpfad angeben, z.B.
page.subparts.TRAILER = etc.

Beschäftige Dich für solche Anwendungen auch mit Conditions die sind oft praktischer als extension templates.

https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Conditions/Index.html

Viele Grüße
Niki

MrBlaschke ·

Hallo Niki.

Vielen Dank für den Hinweis.
Die CONDITIONS hatte ich mir schonmal angeschaut, dachte aber das es zu überzogen ist.

Ich habe es jetzt damit gelöst -> Danke nochmal für den Denkanstoß, aber so richtig kann ich mir nicht vorstellen das es da keinen eleganteren Weg gibt.

Meine Lösung nun:

[globalVar = TSFE:id = 13]
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
 # Feeding the content:
  template = FILE
  template.file = fileadmin/template/template169_neu2.html

 # Select only the content between the <body>-tags
  workOnSubpart = DOCUMENT_BODY

 # Substitute the ###menu_1### subpart with dynamic menu: (top)
  subparts.menu_1 < temp.menu_1

 # Substitute the ###menu_3### subpart with dynamic menu: (bottom)
  subparts.menu_3 < temp.menu_3

 # Substitute the ###footer### subpart with some example content:
  subparts.footer = TEXT
  subparts.footer.value = Copyright &copy; by MrBlaschke

 # Subpart TRAILER
  subparts.TRAILER = IMAGE
  subparts.TRAILER.file = GIFBUILDER
  subparts.TRAILER.file {
	XY = 262, 101
	backColor = #34a4e4
	10 = TEXT
	10.text = Generierte Grafik !!
	10.fontSize = 19
	10.fontFile = fileadmin/template/fonts/arial.ttf
	10.fontColor = #000000
	10.niceText = 1
	10.offset = 10, 60
	10.angle = 15
  }

 # Substitute the ###content### subpart with some example content:
  subparts.content = TEXT
  subparts.content < styles.content.get
}
[global]
[globalVar = TSFE:id > 13]
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
 # Feeding the content:
  template = FILE
  template.file = fileadmin/template/template169_neu2.html

 # Select only the content between the <body>-tags
  workOnSubpart = DOCUMENT_BODY

 # Substitute the ###menu_1### subpart with dynamic menu: (top)
  subparts.menu_1 < temp.menu_1

 # Substitute the ###menu_3### subpart with dynamic menu: (bottom)
  subparts.menu_3 < temp.menu_3

 # Substitute the ###footer### subpart with some example content:
  subparts.footer = TEXT
  subparts.footer.value = Copyright &copy; by MrBlaschke

 # Subpart TRAILER
  subparts.TRAILER = IMAGE
  subparts.TRAILER.file = GIFBUILDER
  subparts.TRAILER.file {
	XY = 262, 101
	backColor = #34a4e4
	10 = TEXT
	10.text = Horst
	10.fontSize = 19
	10.fontFile = fileadmin/template/fonts/arial.ttf
	10.fontColor = #000000
	10.niceText = 1
	10.offset = 10, 60
	10.angle = 15
  }

 # Substitute the ###content### subpart with some example content:
  subparts.content = TEXT
  subparts.content < styles.content.get
}
[global]

Da sich die Änderung nur auf den jeweiligen Text "10.text = Generierte Grafik !!" oder "10.text = Horst" bezieht, also nur eine Zeile finde ich das etwas überzogen das (fast) gesamte Template zu doppeln.

Die CONDITIONS scheinen aber innerhalb einer Arraystruktur (temp.mainTemplate {...Anweisungen...}) nicht zu funktionieren.
Kann das sein ?

Ein folgendes Konstrukt:

temp.mainTemplate = TEMPLATE
temp.mainTemplate {
 # Feeding the content:
  template = FILE
  template.file = fileadmin/template/template169_neu2.html

 # Select only the content between the <body>-tags
  workOnSubpart = DOCUMENT_BODY

 # Substitute the ###menu_1### subpart with dynamic menu: (top)
  subparts.menu_1 < temp.menu_1

 # Substitute the ###menu_3### subpart with dynamic menu: (bottom)
  subparts.menu_3 < temp.menu_3

 # Substitute the ###footer### subpart with some example content:
  subparts.footer = TEXT
  subparts.footer.value = Copyright &copy; by MrBlaschke

 # Subpart TRAILER
  subparts.TRAILER = IMAGE
  subparts.TRAILER.file = GIFBUILDER
  subparts.TRAILER.file {
	XY = 262, 101
	backColor = #34a4e4
	10 = TEXT

[globalVar = TSFE:id = 13]
	10.text = Horst1
[global]

[globalVar = TSFE:id > 13]
	10.text = Horst2
[global]

	10.fontSize = 19
	10.fontFile = fileadmin/template/fonts/arial.ttf
	10.fontColor = #000000
	10.niceText = 1
	10.offset = 10, 60
	10.angle = 15
  }

 # Substitute the ###content### subpart with some example content:
  subparts.content = TEXT
  subparts.content < styles.content.get
}

Scheint nicht zu funktionieren...Jedenfalls bleibt die Ausgabe leer.
Es kommt nur die blaue grafische Bilderzeugung ohne den Text.

Oder habe ich da irgendwas übersehen ?

Danke schonmal,

MrBlaschke (Frank)

Unbekannter Benutzer ·

Conditions funktionieren innerhalb einer array-Struktur (das page Objekt ist immer ein array), nicht jedoch in der Schreibweise mit gewschweiften Klammern.

In die Condition muss nur rein was sich ändert, nicht das gesamte Template. Die Syntax-Schwäche mit den geschweiften Klammern ist dabei zu beachten.

Viele Grüße
Niki

MrBlaschke ·

Oh, dann sollte ich in diesem Fall ohne die {} arbeiten und
stattdessen immer "temp.mainTemplate.weiterführend"
davorhängen ?

Habe ich das richtig verstanden ? :o

Hmm..Zwar auch nicht schön, reduziert aber den Code dann erheblich, bzw. verringert den Wartungsaufwand.