Ich habe eine Extension für mich angepasst, eine Tabelle. Jetzt wird der Inhalt aber nicht in die Spalten geschrieben, sondern ausserhalb. Die Marker bleiben als Inhalt in der Tabelle stehen. #angry#
<?php
require_once(PATH_tslib.'class.tslib_pibase.php');
class user_tabelle_pi1 extends tslib_pibase {
var $prefixId = 'user_tabelle_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.user_tabelle_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'user_tabelle'; // The extension key.
function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj = 1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
$content="";
$marker=array();
$tmpl=$this->cObj->fileResource("fileadmin/tabelle.html");
$tmpl=$this->cObj->getSubpart($tmpl,"###TABELLE###");
$tmpl_eintrag=$this->cObj->getSubpart($tmpl,"###EINTRAG###");
$tabellePageId=$conf["tabellePageId"];
if (!intval($tabellePageId)) $tabellePageId=$GLOBALS["TSFE"]->id;
$res=$GLOBALS["TYPO3_DB"]->exec_SELECTquery("*","user_tabelle_main",
"deleted=0 AND hidden = 0 AND pid ='".$tabellePageId."'");
while($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
$marker["###STRASSE###"]=$row["strasse"];
$marker["###ZIMMER###"]=$row["zimmer"];
$marker["###ETAGE###"]=$row["etage"];
$marker["###QM###"]=$row["qm"];
$marker["###MIETE###"]=$row["miete"];
$marker["###EXPOSE###"]=$row["expose"];
$content.=$this->cObj->substituteMarkerArrayCached($tmpl_eintrag, $marker);
}
$content.=$this->cObj->substituteSubpart($tmpl,"###EINTEAG###", $content);
return $content;;
}
}
?>
plugin.user_tabelle_pi1.templateFile=fileadmin/tabelle.html
<!--###TABELLE### begin-->
<table border="1" width="100%">
<!--###EINTRAG### begin-->
<tr>
<td>###STRASSE###</td>
<td>###ZIMMER###</td>
<td>###ETAGE###</td>
<td>###QM###</td>
<td>###MIETE###</td>
<td>###EXPOSE###</td>
</tr>
<!--###EINTRAG### end-->
</table>
<!--###TABELLE### end-->
</body>
</html>
Typo3 Version 4.2.6
Vielleicht hat ja jemand ne Idee
Hallo.
Also wenn der PHP-Teil kopiert ist und genau so bei Dir ind er Extension ist, dann dürfte es am Tippfehler des Markers in Zeile 38 liegen. 😉
Viele Grüße
Julian
Ja an dem, und noch ein paar anderen Tippfehlern lags, jetzt schreibt er den Text in die Tabelle rein, aber auch extra nochmal außerhalb.
Neuer geänderter Code
<?php
require_once(PATH_tslib.'class.tslib_pibase.php');
class user_tabelle_pi1 extends tslib_pibase {
var $prefixId = 'user_tabelle_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.user_tabelle_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'user_tabelle'; // The extension key.
function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj = 1;
$content="";
$marker=array();
$img_pfad="fileadmin/user_upload/pdf.jpg";
$tmpl=$this->cObj->fileResource("fileadmin/tabelle.html");
$tmpl=$this->cObj->getSubpart($tmpl,"###TABELLE###");
$tmpl_eintrag=$this->cObj->getSubpart($tmpl,"###EINTRAG###");
$tabellePageId=$conf["tabellePageId"];
if (!intval($tabellePageId)) $tabellePageId=$GLOBALS["TSFE"]->id;
$res=$GLOBALS["TYPO3_DB"]->exec_SELECTquery("*","user_tabelle_main",
"deleted=0 AND hidden = 0 AND pid ='".$tabellePageId."'");
while($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
$marker["###STRASSE###"]=$row["strasse"];
$marker["###ZIMMER###"]=$row["zimmer"];
$marker["###ETAGE###"]=$row["etage"];
$marker["###QM###"]=$row["qm"];
$marker["###MIETE###"]=$row["miete"];
$conf["expose."]["file."]["10."]["file"]=$img_pfad.$row["expose"];
if ($this->cObj->fileResource($img_pfad.$row["expose"])){
$marker["###EXPOSE###"]=$this->cObj->cObjGetSingle($conf["expose"],$conf["expose."]);
}else{
$marker["###EXPOSE###"]=$this->cObj->cObjGetSingle($conf["expose_default"],$conf["expose_default."]);
}
$content.=$this->cObj->substituteMarkerArrayCached($tmpl_eintrag, $marker);
}
$content.=$this->cObj->substituteSubpart($tmpl,"###EINTRAG###", $content);
return $content;
}}
?>
plugin.user_tabelle_pi1 {
testObjekt = IMAGE
testObjekt.file = GIFBUILDER
testObjekt.file {
XY = 20,20
backColor = red
}
# Pfad zur Designvorlage als Parameter angeben
templateFile = fileadmin/tabelle.html
# So soll ein Foto eines Tieres formatiert werden.
bild = IMAGE
bild.file = GIFBUILDER
bild.file {
XY = [10.w]+2, [10.h]+2
backColor = black
10 = IMAGE
# Der Pfad zum Bild wird später dynamisch ersetzt.
10.file = unbekannt
10.file.width = 250
10.offset = 1,1
}
# Dieses Bild soll angezeigt werden, wenn kein Foto vorhanden ist.
bild_default = IMAGE
bild_default.file = GIFBUILDER
bild_default.file {
XY = 20, 20
backColor = white
10 = TEXT
10.text = N/A
10.fontFile = fileadmin/fonts/verdana.ttf
10.fontSize = 20
10.fontColor = black
10.niceText = 0
10.offset = 30,25
}
}
<link rel="stylesheet" href="fileadmin/page.css" media="all" type="text/css" />
<!--###TABELLE### begin-->
<table class="exttabelle" width="100%">
<!--###EINTRAG### begin-->
<tr><td class="extfarbe" width="165">Gebiet / Straße</td><td class="extfarbe" width="45">Zimmer</td><td class="extfarbe">Etage</td><td class="extfarbe">qm</td><td class="extfarbe">Miete gesamt</td><td class="extfarbe">Expose</td></tr>
<tr>
<td>###STRASSE###</td>
<td>###ZIMMER###</td>
<td>###ETAGE###</td>
<td>###QM###</td>
<td>###MIETE###</td>
<td>###EXPOSE###</td>
</tr>
<!--###EINTRAG### end-->
</table>
<!--###TABELLE### end-->
</body>
</html>
außerdem zeigt er auch das Bild nicht an, was bei EXPOSE kommen sollte