html-template - subpart - typoscript problem mit Bild
| Autor | Nachricht |
|---|---|
|
Verfasst am: 23. 11. 2008 [16:36]
|
|
|
sefer
Themenersteller
Dabei seit: 26.03.2007
Beiträge: 175
|
Hi, ich mache gerade meine ersten gehversuche mit der Erstellung von Html-Templates. ich habe verschieden Vorlagen und damit baue ich mir gearade das benötigte zusammen. Vorlagen: wiki.typo3.org/index.php/Extension_Development,_using_HTML-Templates www.traum-projekt.com/forum/73-workshops-und-tutorials/101411-workshop-typo3-extension-programmierung-7.html Mein Problem: Ich möchte eigentlich nur das die Bilder in meiner Listenansicht mit einer Maximalbreite von 40px angezeigt werden sollen! PHP <?php //configure image $config = array(); $config['file'] = $this->conf['folder.'][path_uploads].$row['picture']; $config['file.'][maxW] ='40'; $config['file.']['title'] ='TEST'; $image = $this->cObj->IMAGE($config); $markerArray['###'.strtoupper($marker).'###'] = $image; t3lib_div::debug($image, 'image'); ?> Ausgabe: <img src="uploads/tx_sdcars2/7-Car.jpg" width="1200" height="450" border="0" alt="" title="" /> Also das Bild wird ausgegeben, aber nicht in der gewünschten Größe. Woran kann es liegen? Danke! Hier des gesamte Code: PHP <?php /*************************************************************** * Copyright notice * * (c) 2008 Sefer * 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 'SD CARS' for the 'sd_cars_2' extension. * * @author Sefer * @package TYPO3 * @subpackage tx_sdcars2 */ class tx_sdcars2_pi1 extends tslib_pibase { var $prefixId = 'tx_sdcars2_pi1'; // Same as class name var $scriptRelPath = 'pi1/class.tx_sdcars2_pi1.php'; // Path to this script relative to the extension dir. var $extKey = 'sd_cars_2'; // The extension key. var $pi_checkCHash = true; /** * 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) { $this->conf=$conf; //muss eigentlich nicht noch var $conf oben in der Klasse definiert werden? //$content="TEST2"; switch ($this->piVars['action']){ case "view_list": $content.= $this->view_list(); break; case "view_detail": $content.= $this->zurueck("zurück"<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />; $content.= $this->view_detail(); $content.= $this->zurueck("zurück"<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />; break; default: $content.= $this->view_list(); break; } return $this->pi_wrapInBaseClass($content); } function view_detail(){ //t3lib_div::debug($this->conf, 'conf'); // Get the template $this->templateCode = $this->cObj->fileResource($this->conf['templateFileDetail']); //Überprüfe ob Template vorhanden? if ($this->templateCode==""<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />{ $content= "<h3> KEIN HTML TEMPLATE GEFUNDEN IN:</h3>".$this->conf['templateFileDetail']; } // Get the parts out of the template $template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###'); // Fill marker $markerArray['###MARKER1###'] = 'content for marker 1'; $markerArray['###MARKER2###'] = 'content for marker 2'; // Finalize and create the content by replacing the "content" marker in the template $content.= $this->cObj->substituteMarkerArrayCached($template['total'],$markerArray); return $content; } /** * 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 view_list() { //t3lib_div::debug($this->conf, 'conf'); // configure the typolink $this->local_cObj = t3lib_div::makeInstance('tslib_cObj'); $this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id); $this->typolink_conf = $this->conf['typolink.']; $this->typolink_conf['parameter.']['current'] = 1; // Get the template $this->templateCode = $this->cObj->fileResource($this->conf['templateFileList']); //Überprüfe ob Template vorhanden? if ($this->templateCode==""<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />{ $content= "<h3> KEIN HTML TEMPLATE GEFUNDEN IN:</h3>".$this->conf['templateFileList']; } // Get the parts out of the template $template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###'); $template['item'] = $this->cObj->getSubpart($template['total'],'###ITEM###'); // Your SQL query comes here: $from="*"; $from_table="tx_sdcars2_vehicles"; $where="deleted=0 AND hidden=0"; $orderBy=""; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($from,$from_table,$where,$orderBy); // configure typolink $temp_conf = $this->typolink_conf; $temp_conf['useCacheHash']=$this->allowCaching; $temp_conf['no_cache']=!$this->allowCaching; $temp_conf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type; // Loop through query result while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Fill marker AS ARRAY $arrayAll = array('uid', 'name','vehicle_type', 'producer','model','year_of_construstion', 'price','vat','description','sold','in_showroom', 'picture','sales_price','purchase_price', 'cost_transport','cost_other','cost_description'); foreach ($arrayAll as $marker) { if ($marker=="uid"<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />{ // Fill wrapped subpart marker $temp_conf['additionalParams'].= '&'.$this->prefixId.'[action]=view_detail&'.$this->prefixId.'[uid]='.$row['uid']; $wrappedSubpartContentArray['###LINK_UID###'] = $this->local_cObj->typolinkWrap($temp_conf); }elseif($marker=="picture"<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />{ //configure image $config = array(); $config['file'] = $this->conf['folder.'][path_uploads].$row['picture']; $config['file.'][maxW] ='40'; $config['file.']['title'] ='TEEE'; $image = $this->cObj->IMAGE($config); $markerArray['###'.strtoupper($marker).'###'] = $image; t3lib_div::debug($image, 'image'); }else{ $markerArray['###'.strtoupper($marker).'###'] = $row[$marker]; } } // add subpart into a string $content_item .= $this->cObj->substituteMarkerArrayCached($template["item"], $markerArray,'', $wrappedSubpartContentArray); }//WHILE END // Fill subpart marker $subpartArray['###CONTENT###'] = $content_item; // Finalize and create the content by replacing the marker in the template $content = $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray, $subpartArray, $wrappedSubpartContentArray); return $content; } /************************************ * Die Funktion zurueck * @param string $zurueckText * @return $content="back-link" */ function zurueck($zurueckText){ //So erzeugt man automatisch einen Link auf die Seite aktuelle Seite //Würde man einfach die Seite Aktualisieren, dann wird die postVariable erneut gesendet //$content.= ''.$this->pi_linkToPage('<< zurück!',$GLOBALS['TSFE']->id).''; $content.=' '; $content.='<a href="javascript:history.back()">>>'.$zurueckText.'<<</a>'; return $content; } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/sd_cars_2/pi1/class.tx_sdcars2_pi1.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/sd_cars_2/pi1/class.tx_sdcars2_pi1.php']); } ?> Mein aktuelles Projekt www.AMAFU.de: >>Ein Fussballportal für den Amatuer Bereich<<
Hier mein Spielerprofil als Video: www.youtube.com/watch?v=LffIdi-NrIA Mein System:-->Debian: 4.0 --> Typo3: 4.1.2 (aus YAML Komplettpaket)--> PHP Version 5.2.0-8+etch7 -->MYSQL: 5.0.32-Debian_7etch1 |
|
Verfasst am: 24. 11. 2008 [18:45]
|
|
|
its7
Dabei seit: 13.10.2008
Beiträge: 31
|
Hallo , ich benutze folgende Function. Es funktioniert. Ich höffe dieser kleine Kode hilft dir. PHP function createimage($imgsrc) {
$content = '';
$img = array ();
$img['file'] = $imgsrc;
$img['file.']['maxW'] = '100px';
$img['file.']['maxH'] = '100px';
$img['params'] = 'class="mypic"';
$content = $this->cObj->IMAGE($img);
return $content;
}its7 Mit freundlichen Grüßen
its7 |
|
Verfasst am: 24. 11. 2008 [19:57]
|
|
|
sefer
Themenersteller
Dabei seit: 26.03.2007
Beiträge: 175
|
its7 schrieb: ich benutze folgende Function. Es funktioniert. Ich höffe dieser kleine Kode hilft dir. its7 Hi und Danke its7, es ist ja derselbe Code. Ich habe es aber trotzdem versucht, es hat aber nichts gebracht! Da muss irgendetwas grundsätzliches falsch laufen ,aber wiso nimmt er dann den richtigen Pfad? komisch komisch komisch... Bin mit meiner kleinen Extension fast fertig, es fehlt eigentlich nur noch dises Problemlösung mit dem bild. Hat noch jemand ne idee? Danke,Sefer! [Dieser Beitrag wurde 1mal bearbeitet, zuletzt am 24.11.2008 um 19:59.] Mein aktuelles Projekt www.AMAFU.de: >>Ein Fussballportal für den Amatuer Bereich<<
Hier mein Spielerprofil als Video: www.youtube.com/watch?v=LffIdi-NrIA Mein System:-->Debian: 4.0 --> Typo3: 4.1.2 (aus YAML Komplettpaket)--> PHP Version 5.2.0-8+etch7 -->MYSQL: 5.0.32-Debian_7etch1 |
|
Verfasst am: 25. 11. 2008 [22:52]
|
|
|
sefer
Themenersteller
Dabei seit: 26.03.2007
Beiträge: 175
|
Ein Tip wäre ncoh gut, bevor der Post in der Versenkung verschwindet! Danke, Sefer Mein aktuelles Projekt www.AMAFU.de: >>Ein Fussballportal für den Amatuer Bereich<<
Hier mein Spielerprofil als Video: www.youtube.com/watch?v=LffIdi-NrIA Mein System:-->Debian: 4.0 --> Typo3: 4.1.2 (aus YAML Komplettpaket)--> PHP Version 5.2.0-8+etch7 -->MYSQL: 5.0.32-Debian_7etch1 |
|
Verfasst am: 29. 11. 2008 [13:38]
|
|
|
sefer
Themenersteller
Dabei seit: 26.03.2007
Beiträge: 175
|
Endlich!!! Ich hatte, weshalb auch immer, ImageMagick deaktiviert. Eine kleine eins in localconf.php und das wars: $TYPO3_CONF_VARS['GFX']['im'] = '1'; // Modified or inserted by TYPO3 Install Tool. Ciao' Sefer Mein aktuelles Projekt www.AMAFU.de: >>Ein Fussballportal für den Amatuer Bereich<<
Hier mein Spielerprofil als Video: www.youtube.com/watch?v=LffIdi-NrIA Mein System:-->Debian: 4.0 --> Typo3: 4.1.2 (aus YAML Komplettpaket)--> PHP Version 5.2.0-8+etch7 -->MYSQL: 5.0.32-Debian_7etch1 |



