Zum Inhalt springen

Seiteninhalt leer

Erstellt am 10. November 2007 · 2 Antworten · letzte Antwort am 11. November 2007

Tags: Frage

reggaepanda ·

So, bei jeder Extension die ich erstellt habe, selbst welche nach Tutorials (immer über kickstarter) habe ich nie was gesehen wenn ich ein eigenes Template benutzt habe.

In der standardansicht mit Mode1 Mode2 ... seh ich die erstellten Elemente (mit außnahme der bilder, die erscheinen nur als Dateinamen... (NORMAL?))

$this->template=$this->cObj->fileResource('EXT:das_meineextension/template.html');

und im ordner "ext/das_meineextension/" liegt nun die datei "template.html"

habe selbst mal in die template "asdfjklh" in einem <TD> eingefügt, aber der text erscheint auch so nicht (also wollte testen ob es ein datenbankfehler beim abrufen ist). Oder ist das so nicht möglich zu testen.

BITTE um antwort, ich komm sonst echt garnicht weiter 😢

reggaepanda ·
class tx_tptest_pi1 extends tslib_pibase {
    var $prefixId      = 'tx_tptest_pi1';        // Same as class name
    var $scriptRelPath = 'pi1/class.tx_tptest_pi1.php';    // Path to this script relative to the extension dir.
    var $extKey        = 'tp_test';    // The extension key.
    var $pi_checkCHash = true;
    var $template;
    var $id;
    /**
     * The main method of the PlugIn
     *
     * @param    string        $content: The PlugIn content
     * @param    array        $conf: The PlugIn configuration
     * @return    The content that is displayed on the website
     */
    function main($content,$conf)    {
        $this->conf=$conf;
        $this->pi_setPiVarDefaults();
        $this->pi_loadLL();
        
        #ein paar Vorbelegungen
        $this->id=$GLOBALS['TSFE']->id;
        $this->template=$this->cObj->fileResource('EXT:tp_test/template.html');
        
        #welche Ansicht?
        if($this->piVars['item']) {
            $content = $this->detailView();
        } else {
            $content = $this->listView();
        }
    
        return $this->pi_wrapInBaseClass($content);
    }
    
    function listView() {
        #unser Subpart
        $subpart=$this->cObj->getSubpart($this->template,'###LISTVIEW###'); 
        #eine einzelne Reihe
        $singlerow=$this->cObj->getSubpart($subpart,'###ROW###'); 
        
        #Datensätze holen
        $res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
        '*',   #select
        'tx_tptest_items', #from
        'hidden=0 and deleted=0 and pid='.$this->id,  #where
        $groupBy='',
        $orderBy='',
        $limit='');
        
        if($res) {
            $liste='';
            while($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                $markerArray['###LINK###']=$this->pi_linkTP($row['title'],array($this->prefixId.'[item]'=> $row['uid']));
                $liste .= $this->cObj->substituteMarkerArrayCached($singlerow,$markerArray); 
            }
            $subpartArray['###ROW###']=$liste;
        } else {
            return $this->pi_getLL('nodata');
        }
        
        
        return $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,$subpartArray,array());     
        
    }
    
    function detailView() {
        #unser Subpart
        $subpart=$this->cObj->getSubpart($this->template,'###DETAILVIEW###'); 
        
        #Datensatz holen
        $record=$this->pi_getRecord('tx_tptest_items',$this->piVars['item']);
        
        #Marker füllen
        $markerArray['###TITLE###']=$record['title'];
        $markerArray['###DATUM###']=date('d.m.Y',$record['date']);
        $markerArray['###TEXT###']=$this->pi_RTEcssText($record['text']);
        $markerArray['###IMAGE###']=$this->cObj->IMAGE(array(
            'file' => 'uploads/tx_tptest/'.$record['image'],
            'file.maxW' => 140,
        ));
        $markerArray['###LINK###']=$this->cObj->typolink($record['link'],array(
            'parameter' => $record['link'],
            'extTarget' => '_blank',
        ));
        
        #backlink als einfachen Link ohne Parameter
        $markerArray['###BACKLINK###']=$this->pi_linkToPage($this->pi_getLL('back'),$this->id);
        
        return $this->cObj->substituteMarkerArrayCached($subpart,$markerArray,array(),array());     
    }
    
}

ist genau das selbe wie dieses tutorial...

Tutorial