Hi,
ich suche nach einer antwort für folgende Frage:
Wie ist es möglich den Text eines Textfeldes bei einer eigenen extension in ein bild umzuwandeln?
bzw. wie muss ich das TS schreiben und was in die Extension?
für hilfe wäre ich sehr dank bar!
Hi,
ich suche nach einer antwort für folgende Frage:
Wie ist es möglich den Text eines Textfeldes bei einer eigenen extension in ein bild umzuwandeln?
bzw. wie muss ich das TS schreiben und was in die Extension?
für hilfe wäre ich sehr dank bar!
Hallo
Du meinst die Ausgabe soll als bild im fe erscheinen?
MFG
Genau!
Im Konkreten soll das heißen das ich aus meiner Extension Tabelle das feld artikelname über den
Gifbuilder als Image ausgeben möchte.
Hast du ne Lösung?
Hallo
Ich denke schon :-D
$this->cObj->IMAGE($conf);
das ist die funktion die aus der conf. ein bild erzeugt. per guifbulider.
so das conf ist ein array welches du genauso definieren kannst wie im template per typo3 script.
z.b. machs einfach so:
als wenn du einen Menüpunkt generierst also so:
$conf=array();
$conf["file"] = "GIFBUILDER";
$conf["file."]["XY"] = "90,72";
$conf["file."]["15"] = "TEXT";
$conf["file."]["15."]["text"] = "Kein Bild";
$conf["file."]["15."]["offset"] = "18,40";
So wenn du das jetzt alles noch in ein funktion schreibst z.b. so: :o
function feldimage($text) {
$conf=array();
$conf["file"] = "GIFBUILDER";
$conf["file."]["XY"] = "90,72";
$conf["file."]["15"] = "TEXT";
$conf["file."]["15."]["text"] = $text;
$conf["file."]["15."]["offset"] = "18,40";
$this->cObj->IMAGE($conf);
}
Dann kannst du dieses ganz einfach so aufrufen:
kuckst du hier:
$markerArray["###label###"]=$this->feldimage($row["mit dem text"]);
Ich denke das wars.
PS: Du müßtest das natürlich anpassen wegen schrift länge usw.
MFG
ansich ne gute Idee ,
puzzelt mit nur leider kein Image raus 🙁
Muß funktionieren :-)
Klappt bei mir einwandfrei.
Zeig mal dein pi datei.
MFG
Sieht wie folgt aus:
<?php
/***************************************************************
* Copyright notice
*
* (c) 2004 SwiftLizard ()
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Plugin 'Kolektions Artikel Spring Summer 05' for the 'xc_artikel_nhhk' extension.
*
* @author SwiftLizard <>
*/
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_xcartikelnhhk_pi1 extends tslib_pibase {
var $prefixId = "tx_xcartikelnhhk_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_xcartikelnhhk_pi1.php"; // Path to this script relative to the extension dir.
var $extKey = "xc_artikel_nhhk"; // The extension key.
var $conf;
var $templateCode;
//[Put your description here]
function main($content,$conf){
// Besorge die lokale Konfiguration
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
// Lade das Template-File.
$this->templateCode = $this->cObj->fileResource($this->conf["templateFile"]);
if ($this->templateCode=="") {
return "<h3>Kein HTML-Template gefunden:</h3>".$this->conf["templateFile"];
}
// Rufe die Funktion displayAll() auf und schreibe das Ergebnis nach $content
$content .= $this->displayAll();
// Gebe den erstellten Content zurück
return $this->pi_wrapInBaseClass($content);
}
function feldimage($text) {
$conf=array();
$conf["file"] = "GIFBUILDER";
$conf["file."]["XY"] = "90,72";
$conf["file."]["20"] = "TEXT";
$conf["file."]["20."]["text"] = $text;
$conf["file."]["20."]["offset"] = "18,40";
$this->cObj->IMAGE($conf);
}
function displayALL (){
// Lösche $content und lade die lokale Konfiguration für displayAll
$content = "";
$lconf = $this->conf["displayAll."];
// Definiere den Bereich des Templates in dem gearbeitet wird.
// Im Template sieht das dann so aus:
// <!-- ###TEMPLATE_DISPLAY_ALL### begin -->
// ...Der HTML-Code...
// <!-- ###TEMPLATE_DISPLAY_ALL### end -->
$template = $this->cObj->getSubpart($this->templateCode,"###TEMPLATE_DISPLAY_ALL###");
//echo $template;
// Definiere ein Array für die Marker
$markerArray=array();
// Definiere wrappedSubpart --> Muss deifiniert werden wird aber nicht genutzt
$wrappedSubpartArray=array();
// Lese die Daten aus de DB und speicher sie in $rows
$rows = $this->getItems();
// Gehe alle Ausgelesenen Daten durch und schreibe sie ins Template
while( list($c,$row)=each($rows) ){
// Definiere das Foto. Wenn nicht vorhanden setze Dummybild ein.
//Definiere Textfelder
//$markerArray["###ARTIKEL_NAME###"] = $row['artikelname'];
$markerArray["###ARTIKEL_NAME###"]=$this->feldimage($row["artikelname"]);
$markerArray["###ARTIKEL_NUMMER###"] = $row['artikelnummer'];
$markerArray["###ARTIKEL_BESCHREIBUNG###"] = $this->cObj->parseFunc($row['beschreibung'], $this->conf["parser."]);
$markerArray["###HEK_NETTO###"] = $row['hek_netto'];
$markerArray["###HEK_BRUTTO###"] = $row['hek_brutto'];
$markerArray["###UVP_NETTO###"] = $row['uvp_netto'];
$markerArray["###UVP_BRUTTO###"] = $row['uvp_brutto'];
//Definiere Größen
$markerArray["###GROESSE_1###"] = $row['size_1'];
$markerArray["###GROESSE_2###"] = $row['size_2'];
$markerArray["###GROESSE_3###"] = $row['size_3'];
$markerArray["###GROESSE_4###"] = $row['size_5'];
$markerArray["###GROESSE_5###"] = $row['size_5'];
$markerArray["###GROESSE_6###"] = $row['size_6'];
$markerArray["###GROESSE_7###"] = $row['size_7'];
$markerArray["###GROESSE_8###"] = $row['size_8'];
$markerArray["###GROESSE_9###"] = $row['size_9'];
$markerArray["###GROESSE_10###"] = $row['size_10'];
$markerArray["###GROESSE_11###"] = $row['size_11'];
$markerArray["###GROESSE_12###"] = $row['size_12'];
//Definiere Farben
$markerArray["###FARBE_1###"] = $row['color_1'];
$markerArray["###FARBE_2###"] = $row['color_2'];
$markerArray["###FARBE_3###"] = $row['color_3'];
$markerArray["###FARBE_4###"] = $row['color_4'];
$markerArray["###FARBE_5###"] = $row['color_5'];
$markerArray["###FARBE_6###"] = $row['color_6'];
$markerArray["###FARBE_7###"] = $row['color_7'];
$markerArray["###FARBE_8###"] = $row['color_8'];
$markerArray["###FARBE_9###"] = $row['color_9'];
$markerArray["###FARBE_10###"] = $row['color_10'];
$markerArray["###FARBE_11###"] = $row['color_11'];
$markerArray["###FARBE_12###"] = $row['color_12'];
$markerArray["###FARBE_13###"] = $row['color_13'];
// Großes Bild einsetzen
// Definiere das Foto. Wenn nicht vorhanden setze Dummybild ein.
$markerArray["###EMOTION_PIC###"] = $row["emotion_pic"];
// Detail Bilder Einsetzen
$markerArray["###DETAIL_1###"] = $row['detail_1'];
$markerArray["###DETAIL_2###"] = $row['detail_2'];
$markerArray["###DETAIL_3###"] = $row['detail_3'];
$markerArray["###DETAIL_4###"] = $row['detail_4'];
$content.=$this->cObj->substituteMarkerArrayCached($template,$markerArray,array(),$wrappedSubpartArray);
}
// Ein paar Debugbefehle
#t3lib_div::debug($conf);
#t3lib_div::debug($this->getItems());
// Wir geben die gerade erzeugten Daten an die main() Funktion zurück
return $content;
}
function getItems () {
$this->pid = $pid;
$query="SELECT tx_xcartikelnhhk_kollektionartikel.* FROM pages LEFT JOIN tx_xcartikelnhhk_kollektionartikel ON pages.title = tx_xcartikelnhhk_kollektionartikel.artikelnummer WHERE pages.uid=".$GLOBALS['TSFE']->id;
$res = mysql (TYPO3_db, $query);
$out = array ();
while( $row = mysql_fetch_assoc($res) ) {
$out [] = $row;
}
return $out;
}
}
//echo $GLOBALS['TSFE']->id;
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/xc_artikel_nhhk/pi1/class.tx_xcartikelnhhk_pi1.php"]) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/xc_artikel_nhhk/pi1/class.tx_xcartikelnhhk_pi1.php"]);
}
?>
Faszinierender weise funtzt es wenn aus nicht in einer Funktion steht :o
Hallo
Natürlich muß die Funktion mit:
return benendet werden bitte:
function feldimage($text) {
$conf=array();
$conf["file"] = "GIFBUILDER";
$conf["file."]["XY"] = "90,72";
$conf["file."]["15"] = "TEXT";
$conf["file."]["15."]["text"] = $text;
$conf["file."]["15."]["offset"] = "18,40";
return $this->cObj->IMAGE($conf);
}
MFG
kaum mach man es richtig schon gehts... :o