dann nimm statt bilderCObject dein bild bzw bildgross und fertig
georg
dann nimm statt bilderCObject dein bild bzw bildgross und fertig
georg
Hallo Georg,
hab ich versucht, habe vermutlich was falsch gemacht, hier mein ganzer Code ohne Deine beschriebene Änderung. Muss ich meinen Code zum Bild in einer anderen Position einfügen, als ich dies gemacht habe, damit es klappt?
<?php
/***************************************************************
* Copyright notice
*
* (c) 2007 René Schläpfer <r.schlaepfer@ator.ch>
* 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!
***************************************************************/
require_once(PATH_tslib.'class.tslib_pibase.php');
/**
* Plugin 'Motorradhandel' for the 'ator_moto' extension.
*
* @author René Schläpfer <r.schlaepfer@ator.ch>
* @package TYPO3
* @subpackage tx_atormoto
*/
class tx_atormoto_pi1 extends tslib_pibase {
var $prefixId = 'tx_atormoto_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_atormoto_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'ator_moto'; // The extension key.
var $statusCache = array();
var $kategorieCache = array();
var $markeCache = array();
var $ausweiskategorieCache = array();
var $motorbauartCache = array();
var $kraftuebertragungCache = array();
var $bereifungCache = array();
var $bremsenCache = array();
var $farbeCache = array();
var $emissionscodeCache = array();
/**
* Main method of your PlugIn
*
* @param string $content: The content of the PlugIn
* @param array $conf: The PlugIn Configuration
* @return The content that should be displayed on the website
*/
function main($content,$conf) {
switch((string)$conf['CMD']) {
case 'singleView':
list($t) = explode(':',$this->cObj->currentRecord);
$this->internal['currentTable']=$t;
$this->internal['currentRow']=$this->cObj->data;
return $this->pi_wrapInBaseClass($this->singleView($content,$conf));
break;
default:
if (strstr($this->cObj->currentRecord,'tt_content')) {
$conf['pidList'] = $this->cObj->data['pages'];
$conf['recursive'] = $this->cObj->data['recursive'];
}
return $this->pi_wrapInBaseClass($this->listView($content,$conf));
break;
}
}
/**
* Shows a list of database entries
*
* @param string $content: content of the PlugIn
* @param array $conf: PlugIn Configuration
* @return HTML list of table entries
*/
function listView($content,$conf) {
$this->conf=$conf; // Setting the TypoScript passed to this function in $this->conf
$this->pi_setPiVarDefaults();
$this->pi_loadLL(); // Loading the LOCAL_LANG values
$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!
$lConf = $this->conf['listView.']; // Local settings for the listView function
if ($this->piVars['showUid']) { // If a single element should be displayed:
$this->internal['currentTable'] = 'tx_atormoto_moto';
$this->internal['currentRow'] = $this->pi_getRecord('tx_atormoto_moto',$this->piVars['showUid']);
$content = $this->singleView($content,$conf);
return $content;
} else {
$items=array(
'1'=> $this->pi_getLL('list_mode_1','Mode 1'),
'2'=> $this->pi_getLL('list_mode_2','Mode 2'),
'3'=> $this->pi_getLL('list_mode_3','Mode 3'),
);
if (!isset($this->piVars['pointer'])) $this->piVars['pointer']=0;
if (!isset($this->piVars['mode'])) $this->piVars['mode']=1;
// Initializing the query parameters:
list($this->internal['orderBy'],$this->internal['descFlag']) = explode(':',$this->piVars['sort']);
$this->internal['results_at_a_time']=t3lib_div::intInRange($lConf['results_at_a_time'],0,1000,3); // Number of results to show in a listing.
$this->internal['maxPages']=t3lib_div::intInRange($lConf['maxPages'],0,1000,2);; // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
$this->internal['searchFieldList']='modell,typenschein,hubraum,leistung,kmstand,erstzulassung,mfk,gesamtgewicht,garantie,preis,monatlich,zustand,bemerkung';
$this->internal['orderByList']='uid,modell,typenschein,hubraum,leistung,kmstand,erstzulassung,mfk,gesamtgewicht,garantie,preis,monatlich,zustand';
// Get number of records:
$res = $this->pi_exec_query('tx_atormoto_moto',1);
list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
// Make listing query, pass query to SQL database:
$res = $this->pi_exec_query('tx_atormoto_moto');
$this->internal['currentTable'] = 'tx_atormoto_moto';
// Put the whole list together:
$fullTable=''; // Clear var;
# $fullTable.=t3lib_div::view_array($this->piVars); // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!
// Adds the mode selector.
$fullTable.=$this->pi_list_modeSelector($items);
// Adds the whole list table
$fullTable.=$this->pi_list_makelist($res);
// Adds the search box:
$fullTable.=$this->pi_list_searchBox();
// Adds the result browser:
$fullTable.=$this->pi_list_browseresults();
// Returns the content from the plugin.
return $fullTable;
}
}
/**
* Display a single item from the database
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return HTML of a single database entry
*/
function singleView($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!
// This sets the title of the page for use in indexed search results:
if ($this->internal['currentRow']['title']) $GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
$content='<div'.$this->pi_classParam('singleView').'>
<H2>Record "'.$this->internal['currentRow']['uid'].'" from table "'.$this->internal['currentTable'].'":</H2>
<p'.$this->pi_classParam("singleViewField-status").'><strong>'.$this->getFieldHeader('status').':</strong> '.$this->getFieldContent('status').'</p>
<p'.$this->pi_classParam("singleViewField-kategorie").'><strong>'.$this->getFieldHeader('kategorie').':</strong> '.$this->getFieldContent('kategorie').'</p>
<p'.$this->pi_classParam("singleViewField-marke").'><strong>'.$this->getFieldHeader('marke').':</strong> '.$this->getFieldContent('marke').'</p>
<p'.$this->pi_classParam("singleViewField-modell").'><strong>'.$this->getFieldHeader('modell').':</strong> '.$this->getFieldContent('modell').'</p>
<p'.$this->pi_classParam("singleViewField-typenschein").'><strong>'.$this->getFieldHeader('typenschein').':</strong> '.$this->getFieldContent('typenschein').'</p>
<p'.$this->pi_classParam("singleViewField-ausweiskategorie").'><strong>'.$this->getFieldHeader('ausweiskategorie').':</strong> '.$this->getFieldContent('ausweiskategorie').'</p>
<p'.$this->pi_classParam("singleViewField-motorbauart").'><strong>'.$this->getFieldHeader('motorbauart').':</strong> '.$this->getFieldContent('motorbauart').'</p>
<p'.$this->pi_classParam("singleViewField-hubraum").'><strong>'.$this->getFieldHeader('hubraum').':</strong> '.$this->getFieldContent('hubraum').'</p>
<p'.$this->pi_classParam("singleViewField-leistung").'><strong>'.$this->getFieldHeader('leistung').':</strong> '.$this->getFieldContent('leistung').'</p>
<p'.$this->pi_classParam("singleViewField-kraftuebertragung").'><strong>'.$this->getFieldHeader('kraftuebertragung').':</strong> '.$this->getFieldContent('kraftuebertragung').'</p>
<p'.$this->pi_classParam("singleViewField-bereifung").'><strong>'.$this->getFieldHeader('bereifung').':</strong> '.$this->getFieldContent('bereifung').'</p>
<p'.$this->pi_classParam("singleViewField-bremsen").'><strong>'.$this->getFieldHeader('bremsen').':</strong> '.$this->getFieldContent('bremsen').'</p>
<p'.$this->pi_classParam("singleViewField-farbe").'><strong>'.$this->getFieldHeader('farbe').':</strong> '.$this->getFieldContent('farbe').'</p>
<p'.$this->pi_classParam("singleViewField-kmstand").'><strong>'.$this->getFieldHeader('kmstand').':</strong> '.$this->getFieldContent('kmstand').'</p>
<p'.$this->pi_classParam("singleViewField-erstzulassung").'><strong>'.$this->getFieldHeader('erstzulassung').':</strong> '.$this->getFieldContent('erstzulassung').'</p>
<p'.$this->pi_classParam("singleViewField-mfk").'><strong>'.$this->getFieldHeader('mfk').':</strong> '.$this->getFieldContent('mfk').'</p>
<p'.$this->pi_classParam("singleViewField-emissionscode").'><strong>'.$this->getFieldHeader('emissionscode').':</strong> '.$this->getFieldContent('emissionscode').'</p>
<p'.$this->pi_classParam("singleViewField-gesamtgewicht").'><strong>'.$this->getFieldHeader('gesamtgewicht').':</strong> '.$this->getFieldContent('gesamtgewicht').'</p>
<p'.$this->pi_classParam("singleViewField-garantie").'><strong>'.$this->getFieldHeader('garantie').':</strong> '.$this->getFieldContent('garantie').'</p>
<p'.$this->pi_classParam("singleViewField-preis").'><strong>'.$this->getFieldHeader('preis').':</strong> '.$this->getFieldContent('preis').'</p>
<p'.$this->pi_classParam("singleViewField-monatlich").'><strong>'.$this->getFieldHeader('monatlich').':</strong> '.$this->getFieldContent('monatlich').'</p>
<p'.$this->pi_classParam("singleViewField-ausstattung").'><strong>'.$this->getFieldHeader('ausstattung').':</strong> '.$this->getFieldContent('ausstattung').'</p>
<p'.$this->pi_classParam("singleViewField-zustand").'><strong>'.$this->getFieldHeader('zustand').':</strong> '.$this->getFieldContent('zustand').'</p>
<p'.$this->pi_classParam("singleViewField-bemerkung").'><strong>'.$this->getFieldHeader('bemerkung').':</strong> '.$this->getFieldContent('bemerkung').'</p>
<p'.$this->pi_classParam("singleViewField-bilder").'><strong>'.$this->getFieldHeader('bilder').':</strong> '.$this->getFieldContent('bilder').'</p>
<p>'.$this->pi_list_linkSingle($this->pi_getLL('back','Back'),0).'</p></div>'.
$this->pi_getEditPanel();
return $content;
}
/**
* Returns a single table row for list view
*
* @param integer $c: Counter for odd / even behavior
* @return A HTML table row
*/
function pi_list_row($c) {
$editPanel = $this->pi_getEditPanel();
if ($editPanel) $editPanel='<TD>'.$editPanel.'</TD>';
return '<tr'.($c%2 ? $this->pi_classParam('listrow-odd') : '').'>
<td><p>'.$this->getFieldContent('uid').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('status').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('kategorie').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('marke').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('modell').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('typenschein').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('ausweiskategorie').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('motorbauart').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('hubraum').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('leistung').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('kraftuebertragung').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('bereifung').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('bremsen').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('farbe').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('kmstand').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('erstzulassung').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('mfk').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('emissionscode').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('gesamtgewicht').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('garantie').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('preis').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('monatlich').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('ausstattung').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('zustand').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('bilder').'</p></td>
</tr>';
}
/**
* Returns a table row with column names of the table
*
* @return A HTML table row
*/
function pi_list_header() {
return '<tr'.$this->pi_classParam('listrow-header').'>
<td><p>'.$this->getFieldHeader_sortLink('uid').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('status').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('kategorie').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('marke').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('modell').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('typenschein').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('ausweiskategorie').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('motorbauart').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('hubraum').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('leistung').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('kraftuebertragung').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('bereifung').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('bremsen').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('farbe').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('kmstand').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('erstzulassung').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('mfk').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('emissionscode').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('gesamtgewicht').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('garantie').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('preis').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('monatlich').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('ausstattung').'</p></td>
<td><p>'.$this->getFieldHeader_sortLink('zustand').'</p></td>
<td nowrap><p>'.$this->getFieldHeader('bilder').'</p></td>
</tr>';
}
/**
* Returns the content of a given field
*
* @param string $fN: name of table field
* @return Value of the field
*/
function getFieldContent($fN) {
switch($fN) {
case 'uid':
return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1); // The "1" means that the display of single items is CACHED! Set to zero to disable caching.
break;
case "status":
if (!count($this->statusCache)) {
$query = 'SELECT * FROM tx_atormoto_status WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_status');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->statusCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->statusCache[$this->internal["currentRow"]['status']] ['status']);
break;
case "kategorie":
if (!count($this->kategorieCache)) {
$query = 'SELECT * FROM tx_atormoto_kategorie WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_kategorie');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->kategorieCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->kategorieCache[$this->internal["currentRow"]['kategorie']] ['kategorie']);
break;
case "marke":
if (!count($this->markeCache)) {
$query = 'SELECT * FROM tx_atormoto_marke WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_marke');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->markeCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->markeCache[$this->internal["currentRow"]['marke']] ['marke']);
break;
case "ausweiskategorie":
if (!count($this->ausweiskategorieCache)) {
$query = 'SELECT * FROM tx_atormoto_ausweiskategorie WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_ausweiskategorie');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->ausweiskategorieCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->ausweiskategorieCache[$this->internal["currentRow"]['ausweiskategorie']] ['ausweiskategorie']);
break;
case "motorbauart":
if (!count($this->motorbauartCache)) {
$query = 'SELECT * FROM tx_atormoto_motorbauart WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_motorbauart');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->motorbauartCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->motorbauartCache[$this->internal["currentRow"]['motorbauart']] ['motorbauart']);
break;
case "kraftuebertragung":
if (!count($this->kraftuebertragungCache)) {
$query = 'SELECT * FROM tx_atormoto_kraftuebertragung WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_kraftuebertragung');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->kraftuebertragungCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->kraftuebertragungCache[$this->internal["currentRow"]['kraftuebertragung']] ['kraftuebertragung']);
break;
case "bereifung":
if (!count($this->bereifungCache)) {
$query = 'SELECT * FROM tx_atormoto_bereifung WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_bereifung');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->bereifungCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->bereifungCache[$this->internal["currentRow"]['bereifung']] ['bereifung']);
break;
case "bremsen":
if (!count($this->bremsenCache)) {
$query = 'SELECT * FROM tx_atormoto_bremsen WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_bremsen');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->bremsenCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->bremsenCache[$this->internal["currentRow"]['bremsen']] ['bremsen']);
break;
case "farbe":
if (!count($this->farbeCache)) {
$query = 'SELECT * FROM tx_atormoto_farbe WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_farbe');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->farbeCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->farbeCache[$this->internal["currentRow"]['farbe']] ['farbe']);
break;
case "emissionscode":
if (!count($this->emissionscodeCache)) {
$query = 'SELECT * FROM tx_atormoto_emissionscode WHERE pid='.intval($GLOBALS["TSFE"]->id).
$this->cObj->enableFields('tx_atormoto_emissionscode');
$res = mysql(TYPO3_db,$query);
while($row=mysql_fetch_assoc($res)) {
$this->emissionscodeCache[$row['uid']]=$row;
}
}
return htmlspecialchars($this->emissionscodeCache[$this->internal["currentRow"]['emissionscode']] ['emissionscode']);
break;
case "ausstattung":
$query='SELECT * from tx_atormoto_ausstattung '
.' WHERE uid IN ('.$this->internal["currentRow"][$fN].')'
.' AND hidden=0 AND deleted=0 ';
$res = mysql(TYPO3_db,$query);
$result='';
while($row = mysql_fetch_assoc($res)){
$result.=$row['ausstattung'].', ';
}
$result=substr($result,0,(strlen($result)-2));
return $result;
break;
case"bilder":
$imgTSConfig = $this->conf['bilderCObject.'];
$imgTSConfig['file'] = 'uploads/tx_atormoto/'.$this->internal['currentRow'][$fN];
return $this->cObj->IMAGE($imgTSConfig);
break;
default:
return $this->internal['currentRow'][$fN];
break;
}
}
/**
* Returns the label for a fieldname from local language array
*
* @param [type] $fN: ...
* @return [type] ...
*/
function getFieldHeader($fN) {
switch($fN) {
default:
return $this->pi_getLL('listFieldHeader_'.$fN,'['.$fN.']');
break;
}
}
/**
* Returns a sorting link for a column header
*
* @param string $fN: Fieldname
* @return The fieldlabel wrapped in link that contains sorting vars
*/
function getFieldHeader_sortLink($fN) {
return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array('sort'=>$fN.':'.($this->internal['descFlag']?0:1)));
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ator_moto/pi1/class.tx_atormoto_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ator_moto/pi1/class.tx_atormoto_pi1.php']);
}
?>
René
Kann mir hier niemand weiterhelfen?
Danke im Voraus für jede Hilfe.
Gruss René
naja - wer mag sich schon durch einen kompletten Code wühlen für ein Spezialthema.
Was ist so schwer daran, $this->cObj->IMAGE($conf) zweimal mit unterschiedlichen Array aufzurufen ?
Spezialthema? Ich denke das Thema ist nicht sehr speziell, denn es interessiert sicher nicht nur mich, wie man das Problem löst, sondern auch andere.
Ich habe es nun nochmal versucht und nicht geschafft.
Hier die von mir vorgenommenen Anpassungen:
In der Datei ext_typoscript_setup.txt habe ich folgende Einträge gemacht:
plugin.tx_atormoto_pi1 {
bildgrossCObject = IMAGE
bildgrossCObject.file.width = 300
bilderCObject = IMAGE
bilderCObject.file.width = 100
}
In der Datei class.tx_atormoto_pi1.php habe ich folgende Einträge gemacht:
Der Code steht unter "function getFieldContent"
case"bildgross":
$imgTSConfig = $this->conf['bildgrossCObject.'];
$imgTSConfig['file'] = 'uploads/tx_atormoto/'.$this->internal['currentRow'][$fN];
return $this->cObj->IMAGE($imgTSConfig);
break;
case"bilder":
$imgTSConfig = $this->conf['bilderCObject.'];
$imgTSConfig['file'] = 'uploads/tx_atormoto/'.$this->internal['currentRow'][$fN];
return $this->cObj->IMAGE($imgTSConfig);
break;
Die Feldbezeichnung in der Datenbank ist "bilder".
In der Single Ansicht bleibt das Bild leer mit meinen Änderungen im Code.
Sind die Einträge an der richtigen Stelle unter "function getFieldContent" ?
Irgend wo muss ich doch einen Überlegungsfehler anstellen.
Bitte um Lösungsfindende Antworten, nicht um gegenfragen welche mir nichts nützen. Danke
Gruss René
Du machst einen Fehler - im TS muss kein IMAGE-Objekt definiert sein, da Du dieses in php erstellst.
Einfaches Beispiel:
kleinesBild {
file {
maxW = 140
maxH = 90
}
}
$conf=$this->conf['kleinesBild.'];
$conf['file']='uploads/tx_ext/123.jpg';
$bild = $this->cObj->IMAGE($conf);
Mache wohl noch was Falsch, denn keines der Bilder wird mehr angezeigt.
hier die Codeausschnitte die ich angepasst habe.
In der Datei ext_typoscript_setup.txt habe ich folgende Einträge gemacht:
plugin.tx_atormoto_pi1 {
kleinesBild {
file {
maxW = 140
maxH = 90
}
}
grossesBild {
file {
maxW = 240
maxH = 180
}
}
}
In der Datei class.tx_atormoto_pi1.php habe ich folgende Einträge gemacht:
...
function singleView($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!
// This sets the title of the page for use in indexed search results:
if ($this->internal['currentRow']['title']) $GLOBALS['TSFE']->indexedDocTitle=$this->internal['currentRow']['title'];
$content='<div'.$this->pi_classParam('singleView').'>
<p'.$this->pi_classParam("singleViewField-bilder").'><strong>'.$this->getFieldHeader('bilder').':</strong> '.$this->getFieldContent('grossesBild').'</p>
<p>'.$this->pi_list_linkSingle($this->pi_getLL('back','Back'),0).'</p></div>'.
$this->pi_getEditPanel();
return $content;
}
...
function pi_list_row($c) {
$editPanel = $this->pi_getEditPanel();
if ($editPanel) $editPanel='<TD>'.$editPanel.'</TD>';
return '<tr'.($c%2 ? $this->pi_classParam('listrow-odd') : '').'>
<td><p>'.$this->getFieldContent('uid').'</p></td>
<td valign="top"><p>'.$this->getFieldContent('kleinesBild').'</p></td>
</tr>';
}
...
function getFieldContent($fN) {
switch($fN) {
case 'uid':
return $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$this->internal['currentRow']['uid'],1); // The "1" means that the display of single items is CACHED! Set to zero to disable caching.
break;
case"kleinesBild":
$conf=$this->conf['kleinesBild.'];
$conf['file'] = 'uploads/tx_atormoto/'.$this->internal['currentRow'][$fN];
$bild = $this->cObj->IMAGE($conf);
break;
case"grossesBild":
$conf=$this->conf['grossesBild.'];
$conf['file'] = 'uploads/tx_atormoto/'.$this->internal['currentRow'][$fN];
$bild = $this->cObj->IMAGE($conf);
break;
default:
return $this->internal['currentRow'][$fN];
break;
}
}
In der Datenbank ist die Tabelenbezeichnung "bilder"
Finde den Fehler nicht den ich mache, bin wohl schon zulange am suchen
Danke im Voraus
Gruss René
naja, Du musst ja auch die var $bild zurückgeben - da ist das gerenderte Bild drin. also: return $bild
Geht noch immer nicht, habe jetzt folgende Änderung gemacht:
case"grossesBild":
$conf=$this->conf['grossesBild.'];
$conf['file'] = 'uploads/tx_atormoto/'.$this->internal['currentRow'][$fN];
$bild = $this->cObj->IMAGE($conf);
return $bild;
break;
Einige Frage welche ich mir dazu stelle:
- Wie weiss mein Code, in welchem Tabellenfeld der Datenbank die Bezeichnung des Bildes abgelegt ist? "bilder"
- Sind die Bezeichnungen (case"kleinesBild"🙂 und (case"grossesBild"🙂 richtig?
- Sind die Bezeichnungen "kleinesBild" und "grossesBild" im Ausgabecode bei function function pi_list_row bzw. singleView richtig?
Wo mache ich hier einen Überlegungsfehler?
Gruss René
Hat mir niemand einen Typ was ich falsch mache?
Ich komme nicht weiter.
Gruss René
wir haben Dir gezeigt, wie man die Bilder rendert.
Wie Du die ausgibst ist eine zweite Sache, und da wird der Fehler stecken.
Hallo,
in diesem Zusammenhang habe ich eine vielleicht "ganz blöde Frage": Welchen Vorteil hat es,
wenn ich ein Bild mit cObject-IMAGE rendern lasse
im Vergleich zu einer IMG-Ausgabe?
Gruss Mensch
ganz einfach: es wird ein grössenskaliertes Bild erzeugt (IM). Grössenangaben im img-Tag skalieren die Ausgabe, geladen wird aber trotzdem das (grosse) Originalbild.