User:Maholtz/ExtDev

From TYPO3Wiki

Jump to: navigation, search

Contents

[edit] Extension Development

[edit] tca.php

# don't forget to start with this line of code,
# so your php-file cannot executed without typo3
if (!defined ('TYPO3_MODE'))     die ('Access denied.');

There is one big TYPO3 Configuration Array:

$TCA[" name of the table which is configured "] = array ( ...);

[edit] ctrl

tbc

[edit] interface

tbc

[edit] feInterface

tbc

[edit] columns

tbc

[edit] types

usally there is only one type is needed.

have an look at the tca for tt_content to find out the function of this field (change the shown fields if type="image" or type="text" etc)

[edit] palettes

show palettes

   "palettes" => array (
       "1" => array("showitem" => "starttime, endtime, fe_group"),
       "2" => array("showitem" => "field one, field_two, field_three"),
   )


"types" => Array (
    "0" => Array("showitem" => "hidden;;1;;1-1-1,--palette--;Bezeichner der Palette;2")
 ),

"palettes" => Array (
  "1" => Array("showitem" => ""),
  "2" => Array("showitem" => "tag,monat,jahr","canNotCollapse" => 1),
) 


Via "--palette--" wird eine neue Zeile definiert, das Feld danach definiert die Überschrift für die Palette. Danach folgt dann die anzuzeigende Palette. Der Parameter "canNotCollapse" erzwingt, dass die Palette immer angezegit wird, unabhängig von der Einstellung der zweiten Optionspalette.

[edit] CSH - context sensitive help

add in ext_tables.php

Doku: doc_core_inside 3.9. Context Sensitive Help (CSH)

t3lib_extMgm::addLLrefForTCAdescr('table name her','EXT:extension key here /locallang_csh.xml');

typo3.org/documentation/document-library/core-documentation/doc_core_inside/4.1.0/view/3/8/#id4029323

then add in "locallang_csh.xml" (AFAIK: you can change this script name to what ever you want):

// as you know from locallang_db.xml / locallang.php
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
	<meta type="array">
		<description>Describe!</description>
		<type>CSH</type>
		<csh_table>tablename</csh_table>
	</meta>
	<data type="array">
		<languageKey index="default" type="array">
                       <label index=".alttitle">The flyout gets an title (background-color different)</label>
			<label index=".description">Description for the table</label>
			<label index=".details">Details for the table</label>
			<label index="_.seeAlso">Section "see also" | http... (the link goes here)
                                                more links are separated via newlines | http... </label>
                       <label index="_.image">EXT:yourextension/cshimages/image1.png,EXT:yourextension/cshimages/image2.png</label>
			<label index=".image_descr">The images are separated via komma, but the comments
                        are separated via newlines. This line is the comment for the second image.</label>

			<label index="fieldname.details">CSH Label for field fieldname</label>
			<label index="fieldname.description">Description - use html entities like " if you need special chars. (f.e. <strong>strong</strong> and use empty newlines for new paragraphs)</label>
 ....

[edit] TYPO3 Funktionen verwenden

# Cache beeinflussen - doppelt prüfen ob das wohl nötig ist
$TCE = t3lib_div::makeInstance('t3lib_TCEmain');
$TCE->admin = 1;
$TCE->clear_cacheCmd('pages');
$TCE->clear_cacheCmd($pid);


# RTE Inhalte parsen
$out=$this->pi_RTEcssText($data);


[edit] Frontend Programmierung

TypoScript einer Fremden Extension auslesen:

$GLOBALS["TSFE"]->tmpl->setup['plugin.']['extkey.']

[edit] Backend Programmierung

# TypoScript in einem Backend Modul auslesen
function fetchTS($extension, $value, $pageId = 1) {
               $sysPageObj = t3lib_div::makeInstance('t3lib_pageSelect');
               $rootLine = $sysPageObj->getRootLine($pageId);
               $TSObj = t3lib_div::makeInstance('t3lib_tsparser_ext');
               $TSObj->tt_track = 0;
               $TSObj->init();
               $TSObj->runThroughTemplates($rootLine);
               $TSObj->generateConfig();
               return $TSObj->setup['plugin.'][$extension . '.'][$value];
       }
# cObject in Backend
http://www.typo3-scout.de/2008/05/28/cobject-im-backend/

[edit] SQL Funktionen

  • last_insert_id: $GLOBALS['TYPO3_DB']->sql_insert_id()

[edit] sonstiges

// This sets the title of the page for use in indexed search results:
$GLOBALS['TSFE']->indexedDocTitle= 'hello world';


# Konstanten auslesen
$PageTSconfig =  t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
$websiteID =   $PageTSconfig['TSFE.']['constants.']['websiteConfig.']['id'];
Personal tools