Show Menu
Cheatography

TYPO3 4.5 API Cheat Sheet (DRAFT) by

List of the important TYPO3 API classes and their most important functions

This is a draft cheat sheet. It is a work in progress and is not finished yet.

T3lib_DB

exec_I­NSE­RTquery ($table, $field­_va­lues)
Inserts a row into the database
exec_U­PDA­TEquery ($table, $where, $field­_va­lues)
Updates a row into the database
exec_S­ELE­CTquery ($fields, $table, $where, $groupby, $orderby, $limit)
Select rows from a database
sql_query ($sql)
Executes a typed query
sql_nu­m_rows ($res)
Returns the number of rows
sql_fe­tch­_assoc ($res)
Returns an associ­ative row
sql_in­sert_id ($res)
Returns the last inserted autoin­crement ID
sql_af­fec­ted­_rows ($res)
Returns the number of affected rows
sql_error ()
Returns the last SQL error message
fullQu­oteStr ($str, $table)
Escapes a string
fullQu­ote­Array ($arr, $table)
Escapes all of the values of an array
Call with $GLOBA­LS[­'TY­PO3­_DB­']->

tslib_cObj

enable­Fields ($table)
Returns $where params to filter records
getSubpart ($content, $marker)
Returns a subpart from a template
substi­tut­eMarker ($content, $marker, $content)
substitute a single marker
substi­tut­eMa­rke­rArray ($content, $marke­rArray)
Substitute all markers in the array
substi­tut­eMa­rke­rAr­ray­Cache ($content, $markers, $subparts, $wrapped)
More advanced function. Causes Cache problems
stdWrap ($content, $conf)
Executes a stdWrap
cObjGe­tSingle ($name, $conf )
Creates a TS object with the value $conf
whereS­ele­ctF­romList ($field, $value)
Where to search for a value in a CSV list
 

T3lib_DIV

makeIn­stance ($clas­sname)
Creates an instance of a TYPO3 class
tempnam ($file­Prefix)
Create the name of a tempfile
unlink­_te­mpfile ( $tempf­ile­name)
Removes a tempfile
upload­_to­_te­mpfile ($uplo­ade­d_f­ile­name)
Moves a PHP uploaded file into a TYPO3 temp file
_GET ($var=­null)
Retrieves a GET variable (or the _GET array)
_POST ($var=­null)
Retrieves a POST variable (or the _POST array)
_GPmerged ($var=­null)
Retrieves a GET or POST variable (POST takes priority)
intExp­lode( $delim­eter, $string )
Explodes a string, ensuring all values are INT
trimEx­plode ($deli­meter, $string)
Explodes a string, trimming all values
view_array ( $array)
Returns the HTML output of an array
getindpEnv ($envName)
Returns System Variables like REMOTE­_ADDR
All T3lib_DIV functions are STATIC. Call by prefixing t3lib_­div::

tslib_­pibase

pi_get_LL ($key, $default)
Retrieves a localized language label
pi_lin­kToPage ($str, $id, $target, $params)
Links to a page. Params need Prefix
pi_linkTP ($str, $params, $cache, $id)
Links to the current page. Params need Prefix
pi_lin­kTP­_ke­yPiVars ($str, $pivars, $cache, $clear, $id)
Links to current page, keeping piVars. No Prefix.
pi_lin­kTP­_ke­epP­iva­rs_url ($pivars, $cache, $clear, $id)
Same as above, but returns only the URL
pi_lis­t_l­ink­Single ($str, $uid, $cache, $pivars, $id )
Links to the Single View page of the plugin.
pi_lis­t_b­row­ser­results (...)
Returns a browse result at bottom
pi_lis­t_s­ear­chBox ()
Makes a searchbox
pi_get­Record ($table, $uid)
Retrieves a record of a table
pi_get­FFvalue ($flex­form, $field, $sheet, $lang, $value )
Allows to extract a value from a FlexForm
This is the base class of front-end plugins
 

Typoscript Objects

HTML
Allows to display HTML elements
TEXT
Allows to display TEXT (including data elements)
COA
Allows to show a list of objects
COA_INT
Same as COA, but no caching
FILE
Displays the content of a file
IMAGES
Displays an image
IMG_RE­SOURCES
Returns the reference to an image
CONTENT
Return Content Elements
RECORDS
Return records
HMENU
Creates a HMENU
IMGTEXT
Display an image with a caption
CASE
Like a COA, but displays only 1
LOAD_R­EGISTER
Allows to retrieve a PHP value
USER
Allows to call a user script
USER_INT
Same as User but with no caching
TEMPLATE
Used to link a template
MEDIA
Return a video or audio player
SWFOBJECT
Return a flash object
GIFBUILDER
Used with an IMAGE to make an image
TMENU
Used with HMENU to make text menus
TMENUITEM
Implicitly used with TMENU to make menu items