Typo3 Extensions entwickeln @deprecated

Aus Vosp.info
Version vom 17. Februar 2013, 00:08 Uhr von F (Diskussion | Beiträge) (Dokumentation)
Wechseln zu:Navigation, Suche

Typo3

um sich das Grundgerüst einer Extension erstellen zu lassen bitte hier schauen Typo3 kickstarter Extension

tslib_pibase

Beispiel mit template, css und Sprachdatei

Template mit html

pi1/templates/template.html

1  <!-- ###SUBPART1### begin -->
2  	<div ID="VAR1">###VAR1###</div> 
3  	<div ID="SUBPART2_MARKER">###SUBPART2_MARKER###</div>
4  	<div ID="VAR_CONF">###VAR_CONF###</div> 
5  <!-- ###SUBPART1### end -->
6  
7  <!-- ###SUBPART2### begin -->
8  	<div ID="VAR2">###VAR2###</div>
9  <!-- ###SUBPART2### end -->

Design mit css

pi1/template.css

1  div#VAR1 {
2  	font-size: 12px;	color:red;
3  }
4  div#VAR2 {
5  	font-size: 14px;	color:blue;
6  }
7  div#VAR_CONF{
8  	font-size: 16px;	color:green;
9  }

Lokalisierung mit xml

pi1/locallang.xml

 1  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 2  <T3locallang>
 3  	<meta type="array">
 4  		<type>module</type>
 5  		<description>Language labels for plugin &quot;tx_testit_pi1&quot;</description>
 6  	</meta>
 7  	<data type="array">
 8  		<languageKey index="default" type="array">
 9  			<label index="VAR1">text for var 1 in english</label>
10  			<label index="VAR2">text for var 2 in english</label>
11  		</languageKey>
12  		<languageKey index="de" type="array">
13  			<label index="VAR1">Text für var 1 in deutsch</label>
14  			<label index="VAR2">Text für var 2 in deutsch</label>
15  		</languageKey>
16  	</data>
17  </T3locallang>

Konfiguration mit Flexforms

pi/flexform_ds_pi1.xml

 1  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 2  <T3DataStructure>
 3     <sheets>
 4         <Konfigurationsformular>
 5             <ROOT>
 6                 <TCEforms>
 7                     <sheetTitle>LLL:EXT:testit/locallang_db.xml:tt_content.list_type_pi1</sheetTitle>
 8                 </TCEforms>
 9                 <type>array</type>
10                 <el>
11                     <VAR_CONF_Formular>
12                         <TCEforms>
13                             <label>LLL:EXT:testit/locallang_db.xml:VAR_CONF</label>
14                             <config>
15                                 <type>input</type>
16                                 <size>100</size>
17                             </config>
18                         </TCEforms> 
19                     </VAR_CONF_Formular>
20                  </el>
21              </ROOT>
22          </Konfigurationsformular>
23      </sheets>
24  </T3DataStructure>

locallang_db.xml

 1  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 2  <T3locallang>
 3  	<meta type="array">
 4  		<type>database</type>
 5  		<description>Language labels for database tables/fields belonging to extension 'testit'</description>
 6  	</meta>
 7  	<data type="array">
 8  		<languageKey index="default" type="array">
 9  			<label index="tt_content.list_type_pi1">testit title</label>
10  			<label index="VAR_CONF">please set a value for the frontend</label>
11  		</languageKey>
12  		<languageKey index="de" type="array">
13  			<label index="tt_content.list_type_pi1">testit Title</label>
14  			<label index="VAR_CONF">bitte einen Wert fürs Frontend setzen</label>
15  		</languageKey>
16  	</data>
17  </T3locallang>

ext_tables.php folgende Zeilen hinzufügen

16 <?
17  // ....
18  $TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_pi1']='pi_flexform';
19  t3lib_extMgm::addPiFlexFormValue($_EXTKEY.'_pi1', 'FILE:EXT:'.$_EXTKEY.'/pi1/flexform_ds_pi1.xml');
20 ?>

Software mit php

pi1/class.tx_testit_pi1.php (bzw. die Hauptklasse)

 1 <?php
 2  class tx_testit_pi1 extends tslib_pibase {
 3  	// ....
 4  	public function main($content, array $conf) {
 5  		// speichern der Konfiguration 
 6  		$this->conf = $conf;
 7  		// POST GET wird geladen
 8  		$this->pi_setPiVarDefaults();
 9  		// Sprachdaten werden geladen
10  		$this->pi_loadLL(); 		
11   
12  		// css wird included 
13  		$GLOBALS['TSFE']->pSetup['includeCSS.'][$this->extKey] = 'EXT:' . $this->extKey . '/pi1/css/template.css';
14   
15  		// Template wird included
16  		$this->template = $this->cObj->fileResource('EXT:' . $this->extKey . '/pi1/templates/template.html');
17  
18  		// Subparts werden extrahiert
19  		$tmpl_SUBPART1 = $this->cObj->getSubpart($this->template, '###SUBPART1###');
20  		$tmpl_SUBPART2 = $this->cObj->getSubpart($this->template, '###SUBPART2###');
21  
22  		//   Flexform laden
23  		$this->pi_initPIflexForm();
24  
25  		// Werte werden für die Marker gesetzt
26  		$array_markers = array(
27  			'###VAR1###' => $this->pi_getLL('VAR1'),
28  			'###VAR2###' => $this->pi_getLL('VAR2'),
29  			'###VAR_CONF###' => $this->pi_getFFvalue($this->cObj->data['pi_flexform'], "VAR_CONF_Formular", "Konfigurationsformular"),
30  		);
31  
32  		// der Subpart 2 wird ins SUBPART2_MARKER gesetzt
33  		$array_markers['###SUBPART2_MARKER###'] = $this->cObj->substituteMarkerArrayCached($tmpl_SUBPART2, $array_markers);
34  
35  		// 
36  		$content = $this->cObj->substituteMarkerArrayCached($tmpl_SUBPART1, $array_markers);
37  
38  		return $this->pi_wrapInBaseClass($content);
39  	}
40  	// ....
41  }
42 ?>

Dokumentation

offizielle Typo3-Extension-Dokumentations-Vorlage runterladen und manual.swx ins doc Verzeichniss

jquery