Hallo
wie kann ich in meiner Extension das Feld CODE auslesen?
Grüße
Hallo
wie kann ich in meiner Extension das Feld CODE auslesen?
Grüße
dazu gibt es 1000 how tos auf www.typo3.org
$this->code = (string)$this->cObj->data["select_key"];
Gruss
Thomas
@tmallee
Danke
@Tetramatrix
ich hab nix gefunden, kanns ja nich soviel sein, lieber nen Link posten, statt "das gibts schon alles"
Grüße
oh doch, must nur besser gucken.
moin
hab mal nach select_key gesucht und nix gefunden was mir hilft :-(
irgenwie krieg ich das Feld nicht ausgelesen???
ich will dort einen Pfad reinschreiben, aus dem Bilder gelesen werden sollen und in ene Tabelle eingeordnet werden müssen
hab mal meinen jetzigen Code angehängt, vielelicht hat ja einer ne Idee
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_ctgallery_pi1 extends tslib_pibase {
var $prefixId = "tx_ctgallery_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_ctgallery_pi1.php"; // Path to this script relative to the extension dir.
var $extKey = "ct_gallery"; // The extension key.
/*
* main function
*/
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
/*
* Get the necessary database rows
*/
$query = "SELECT dir FROM tx_ctgallery_dir WHERE pid=".$GLOBALS["TSFE"]->id.$this->cObj->enableFields("tx_ctgallery_dir");
// execute query
$result=mysql(TYPO3_db,$query);
// some values
$this->columns = $this->conf["columns"];
$this->border = $this->conf["border"];
$dir = mysql_fetch_row($result);
$filesarray = array();
$result_table = '<table border="0" cellspacing="0" cellpadding="3" width="100%">'."
".'<tr align="center" valign="center">'."
";
while ($dir)
{
$files = opendir($dir[0]);
$i=1;
while ($file = readdir($files))
{
if ($file!="thumb" && $file!="." && $file!="..")
{
$filesarray[]= $file;
}
}
closedir($files);
sort($filesarray);
foreach($filesarray as $file)
{
if ($i > $this->columns)
{
$result_table .='</tr>'."
";
$result_table .='<tr align="center" valign="center">'."
";
$i=1;
}
if ($file!="thumb" && $file!="." && $file!="..")
{
$result_table .='<td><a href="'.$dir[0].$file.'"><img src="'.$dir[0]."/thumb/".$file.'" border='.$this->border.'></a></td>'."
";
$i++;
}
}
$dir = mysql_fetch_row($result);
}
$result_table .= "</tr>
</table>
";
$content=$result_table;
return $this->pi_wrapInBaseClass($content);
}
}
Hi shizen,
füge zwei Zeilen ein. Oben als Instanzvariable
var $theCode;
(direkt unter die Zeile "var $extKey" setzen)
Und hiermit bekommst Du den aktuellen Code angezeigt und kannst ihn auch auswerten:
debug( $this->config["code"] );
$this->theCode= $this->config["code"];
(in main. aber erst nach der Übernahme der Konfigurations-Einstellungen per "this->conf=$conf;" )
That's it. Have phun!
Daniel
Erstemal Danke, funz leider nich :-(
ich denke das Debug soll ne Ausgabe machen, machts aber nicht, jedenfalls nicht in die Seite rein :-(
häng den Code mal wieder mit ran, nur das ich keine Fehler gemacht hab.
Was auch komisch ist, das Feld Code verschindet nach dem einfügen des Plugins, ob ich was reinschreib oder nich, hats damit was zu tun???
<?php
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_ctgallery_pi1 extends tslib_pibase {
var $prefixId = "tx_ctgallery_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_ctgallery_pi1.php"; // Path to this script relative to the extension dir.
var $extKey = "ct_gallery"; // The extension key.
var $theCode;
/*
* main function
*/
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
/*
* Get the necessary database rows
*/
//$query = "SELECT dir FROM tx_ctgallery_dir WHERE pid=".$GLOBALS["TSFE"]->id.$this->cObj->enableFields("tx_ctgallery_dir");
// execute query
//$result=mysql(TYPO3_db,$query);
// some values
$this->columns = $this->conf["columns"];
$this->border = $this->conf["border"];
debug( $this->config["code"] );
$this->theCode= $this->config["code"];
//$dir = mysql_fetch_row($result);
$filesarray = array();
$result_table = '<table border="0" cellspacing="0" cellpadding="3" width="100%">'."
".'<tr align="center" valign="center">'."
";
//while ($dir)
//{
$files = opendir($this->theCode);
$i=1;
while ($file = readdir($files))
{
if ($file!="thumb" && $file!="." && $file!="..")
{
$filesarray[]= $file;
}
}
closedir($files);
sort($filesarray);
foreach($filesarray as $file)
{
if ($i > $this->columns)
{
$result_table .='</tr>'."
";
$result_table .='<tr align="center" valign="center">'."
";
$i=1;
}
if ($file!="thumb" && $file!="." && $file!="..")
{
$result_table .='<td><a href="'.$dir[0].$file.'"><img src="'.$dir[0]."/thumb/".$file.'" border='.$this->border.'></a></td>'."
";
$i++;
}
}
//$dir = mysql_fetch_row($result);
//}
$result_table .= "</tr>
</table>
";
$content=$result_table;
return $this->pi_wrapInBaseClass($content);
}
}
?>
Na, sind ja noch ein paar Hürden.
Das CODE-Feld selbst kannst Du so editierbar machen:
Editiere die ext_tables.php und nimm select_key aus der exclude-Liste raus. Denn normalerweise braucht man das ja nicht.
Und an den code kommst Du doch nicht so einfach ran. Es muss so heißen:
$this->config["code"] = $this->cObj->stdWrap($this->conf["code"],$this->conf["code."]);
Tja die Meldungen bekommst Du nur mit dem hauseigenen debug:
t3lib_div::debug( $this->config["code"] );
Zusammen also:
$this->config["code"] = $this->cObj->stdWrap($this->conf["code"],$this->conf["code."]);
t3lib_div::debug( $this->config["code"] );
Nun aber!
Greeetz
Daniel
Hi zusammen..
ich habe das ganze so gemacht wie beschrieben. Zur Sicherheit hatte ich mir auch nochmal den Code in der tt_guest angesehen, welcher aber mit deinem übereinstimmt.
jedoch bekomme ich nur ein DEBUG| ausgegeben 🙁
Muss man noch irgendetwas anderes einstellen ?