Morgen zusammen!
Bin am verzweifeln. Ich habe ein PHP-Skript mit verschiedenen Funktionen, die Strings zurückgeben. Zum testen habe ich den einfachsten Fall genommen und es steht in der PHP-Datei die Funktion
function getBackColor()
{
return '#ABCDEF';
}
Das die Funktion läuft und auch was zurückgibt habe dahingehend getestet, dass ich einen Subpart von mir folgendermaßen gefüllt habe:
subpart.content = USER
subpart.content.userFunc = meineKlasse->getBackColor
Da hatte ich dann auch im Content-Bereich #ABCDEF stehen.
Nun will ich aber, dass dieser Rückgabewert beim GIFBUILDER verwendet wird. Es soll nämlich die Hintergrundfarbe des Bildes, und später auch der Text und die Textfarbe, dynamisch von diesem PHP-Skript kommen.
Habe dann folgendes probiert:
marks.ISSUE_NUMBER = IMAGE
marks.ISSUE_NUMBER {
file = GIFBUILDER
file {
XY = 30, 65
#backColor = #CD9826
backColor = USER
backColor.userFunc = meineKlasse->getBackColor
10 = TEXT
10 {
fontSize = 18
fontColor = #DDDDDD
fontFile = fileadmin/templates/fonts/arialbd.ttf
text = No. 39
angle = 90
offset = 22, 55
}
}
}
}
Fand ich eigentlich recht logisch, allerdings passiert da nix, und ich bekomme immer nur einen schwarzen Hintergrund. Habe schon versucht erst ein temp.backColor anzulegen und das dann bei der backColor im GifBuilder anzugeben, aber mit dem selben Ergebnis.
Hoffe jemand hat schon mal diese Erfahrung gemacht und das Problem lösen können. Vielleicht stehe ich auch nur auf dem Schlauch.
tpinne
Hallo nochmal,
bin nun schon ein ganzes Stück weiter gekommen. Habe es nun geschafft, dass die Hintergrundfarbe und der Text von dem PHP-Skript übernommen werden. Lediglich die Schriftfarbe wird nicht akzeptiert. zumindest nicht auf die gleiche Art und Weise, wie ich die anderen beiden Sachen zugewiesen habe.
Hier mein TS-Code
includeLibs.something = typo3conf/ext/jp_issues/pi1/class.tx_jpissues_pi1.php
temp.Text = USER
temp.Text.userFunc = tx_jpissues_pi1->getText
temp.BackColor = USER
temp.BackColor.userFunc = tx_jpissues_pi1->getBackColor
temp.FontColor = USER
temp.FontColor.userFunc = tx_jpissues_pi1->getFontColor
temp.contentAreaTemplate = TEMPLATE
temp.contentAreaTemplate {
template =< plugin.tx_automaketemplate_pi1
// Modify the template selector config: This is a sub template!
template.content.templateType = sub
workOnSubpart = DOCUMENT_BODY
subparts.content < styles.content.get
subparts.right_border_content < styles.content.getRight
subparts.navigation < temp.menue
subparts.service < temp.service_menue
subparts.contact_person_box < plugin.tx_jpstaff_pi1
marks.ISSUE_NUMBER = IMAGE
marks.ISSUE_NUMBER {
file = GIFBUILDER
file {
XY = 30, 65
#backColor = #CD9825
backColor.cObject < temp.BackColor
#transparentBackground = 0
10 = TEXT
10 {
fontSize = 18
fontColor.cObject < temp.FontColor
fontFile = fileadmin/templates/fonts/arialbd.ttf
text.data = page:title
text.cObject < temp.Text
angle = 90
offset = 22, 55
}
}
}
}
Und hier mein PHP-Code, der eigentlich laufen sollte, habe zum Test bei der Funktion getFontColor() einen festen Rückgabewert angegeben:
function getBackColor()
{
$this->getRecords();
return $this->data["BackColor_1"];
}
function getFontColor()
{
$this->getRecords();
return '#EEDB3F';
}
function getText()
{
$this->getRecords();
return $this->data["text"];
}
function getRecords()
{
$query = "SELECT uid, tx_jpissues_is_issue, tx_jpissues_number, tx_jpissues_colour_code FROM pages WHERE tx_jpissues_actual=1 LIMIT 0,1";
$res = mysql(TYPO3_db, $query);
$actual["issue"] = mysql_fetch_assoc($res);
$query = "SELECT uid, tx_jpissues_is_issue, tx_jpissues_number, tx_jpissues_colour_code FROM pages WHERE uid=".$GLOBALS["TSFE"]->id." LIMIT 0,1";
$res = mysql(TYPO3_db, $query);
$actual["site"] = mysql_fetch_assoc($res);
if ($actual["issue"]["uid"] == $actual["site"]["uid"] || $actual["site"]["tx_jpissues_is_issue"] != 1) {
// Setting the colors
$this->data["BackColor_1"] = '#'.$actual["issue"]["tx_jpissues_colour_code"];
if(hexdec($actual["issue"]["tx_jpissues_colour_code"]) < hexdec('24221E')) {
$this->data["BackColor_2"] = '#'.dechex(hexdec($actual["issue"]["tx_jpissues_colour_code"]) + hexdec('24221E'));
}
else {
$this->data["BackColor_2"] = '#'.dechex(hexdec($actual["issue"]["tx_jpissues_colour_code"]) - hexdec('24221E'));
}
//Setting the Text
$this->data["text"] = 'Nr. '.$actual["issue"]["tx_jpissues_number"];
//Setting the FontColor
$this->data["FontColor"] = '#'.dechex(hexdec($this->data["BackColor_1"]) + hexdec('214319'));
}
else {
// Setting the colors
$this->data["BackColor_1"] = '#'.$actual["site"]["tx_jpissues_colour_code"];
if(hexdec($actual["site"]["tx_jpissues_colour_code"]) < hexdec('24221E')) {
$this->data["BackColor_2"] = '#'.dechex(hexdec($actual["site"]["tx_jpissues_colour_code"]) + hexdec('24221E'));
}
else {
$this->data["BackColor_2"] = '#'.dechex(hexdec($actual["site"]["tx_jpissues_colour_code"]) - hexdec('24221E'));
}
//Setting the Text
$this->data["text"] = 'Nr. '.$actual["site"]["tx_jpissues_number"];
//Setting the FontColor
$this->data["FontColor"] = '#'.dechex(hexdec($this->data["BackColor_1"]) + hexdec('214319'));
}
}
Hoffe jemand kann mir weiter helfen.
Gruß Tpinne