[TYPO3-german] randomized Headergrafiken, was: [TYPO3-german] [SOLVED] Condition über Anzahl der Zeichen

Markus Bucher markus.bucher at bedv.de
Wed Feb 8 17:17:06 CET 2006


Hi Arnd, hallo Liste.

Danke für dein Skript, es funktioniert einwandfrei. Ich habe nur 
"isGreaterThan" in "isLessThan" geändert, damit es funktioniert.

Für die Nachwelt hier mein kompletter Code für ein randomized Headerbild 
mit Ausgabe des Subtitles, wenn dieser nicht länger als 28 Zeichen ist.

### TypoScript ###

page.includeLibs.count = media/scripts/user_countString.inc.php

temp.TITLEIMAGE = COA

# Einbinden der Abfrage der Länge des Titels und Ablegen in register:count_t
temp.TITLEIMAGE.5 =  LOAD_REGISTER
temp.TITLEIMAGE.5.count_t = www.homepage.com
temp.TITLEIMAGE.5.count_t.override.data = page:subtitle
temp.TITLEIMAGE.5.count_t.postUserFunc = user_countString

temp.TITLEIMAGE.10 = IMAGE
temp.TITLEIMAGE.10.file = GIFBUILDER
temp.TITLEIMAGE.10.file {
	XY = [2.w], [2.h]
	2 = IMAGE
	2.file = {$header_bg}
	10 = TEXT
	10.text = www.homepage.com
	10.text.override.data = page:subtitle
	10.text.override.if {
	value = 28
	isLessThan.data = register:count_t
	}
	10.offset = 40, 58
	10.fontFile = fileadmin/fonts/Sans_Bold.ttf
	10.fontSize = 55
	10.fontColor = {$header_color}
	10.niceText = 1
	10.shadow.blur = 1
	10.shadow.opacity = 100
	10.shadow.color = white
	10.shadow.intensity = 40
    }
temp.TITLEIMAGE.10.wrap = <div id="banner1" style="position:absolute; 
left:0px; top:0px; width:967px; height:176px;">|</div>
temp.TITLEIMAGE.20 = COA
temp.TITLEIMAGE.20.10 = TEXT
temp.TITLEIMAGE.20.10.value = <img alt="Headergrafik" 
src="fileadmin/headergrafiken_archiv/{$header_theme}/headgrafik_
temp.TITLEIMAGE.20.20 = PHP_SCRIPT_EXT
temp.TITLEIMAGE.20.20.file = media/scripts/random_header.inc.php
temp.TITLEIMAGE.20.30 = TEXT
temp.TITLEIMAGE.20.30.value = .jpg" />
temp.TITLEIMAGE.20.wrap = <div id="banner2" style=" position:absolute; 
left:0px; top:61px; width:967px; height:115px;">|</div>
page.10.subparts.TITLEVHEADER < temp.TITLEIMAGE

### user_countString.inc.php ### (von Arnd)
<? php
function user_countString($text) {
     $result = strlen($text);
     return $result;
}
?>

### random_header.inc.php ###
<?php
         /* Gibt eine Zufallszahl als Klartext aus */
         /* Diesen Wert mit der Menge der Randoms abstimmen */
         global $zufallszahl;
         $anzahl_rand = 9;
         $randNum_rand = rand(1,$anzahl_rand);
         $zufallszahl = "".$randNum_rand."";
         print $zufallszahl;
?>


Vielleicht kanns ja jemand brauchen.
Anregungen und Kommentare erbeten ;-)

Gruß
Markus Bucher
--
markusbucher.de



More information about the TYPO3-german mailing list