\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{mpierre} \pdfinfo{ /Title (typo3-4-5-api.pdf) /Creator (Cheatography) /Author (mpierre) /Subject (TYPO3 4.5 API Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{000000} \definecolor{LightBackground}{HTML}{F7F7F7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{TYPO3 4.5 API Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{mpierre} via \textcolor{DarkBackground}{\uline{cheatography.com/5927/cs/1054/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}mpierre \\ \uline{cheatography.com/mpierre} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 11th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{T3lib\_DB}} \tn % Row 0 \SetRowColor{LightBackground} exec\_INSERTquery (\$table, \$field\_values) & Inserts a row into the database \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} exec\_UPDATEquery (\$table, \$where, \$field\_values) & Updates a row into the database \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} exec\_SELECTquery (\$fields, \$table, \$where, \$groupby, \$orderby, \$limit) & Select rows from a database \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} sql\_query (\$sql) & Executes a typed query \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} sql\_num\_rows (\$res) & Returns the number of rows \tn % Row Count 13 (+ 2) % Row 5 \SetRowColor{white} sql\_fetch\_assoc (\$res) & Returns an associative row \tn % Row Count 15 (+ 2) % Row 6 \SetRowColor{LightBackground} sql\_insert\_id (\$res) & Returns the last inserted autoincrement ID \tn % Row Count 18 (+ 3) % Row 7 \SetRowColor{white} sql\_affected\_rows (\$res) & Returns the number of affected rows \tn % Row Count 20 (+ 2) % Row 8 \SetRowColor{LightBackground} sql\_error () & Returns the last SQL error message \tn % Row Count 22 (+ 2) % Row 9 \SetRowColor{white} fullQuoteStr (\$str, \$table) & Escapes a string \tn % Row Count 24 (+ 2) % Row 10 \SetRowColor{LightBackground} fullQuoteArray (\$arr, \$table) & Escapes all of the values of an array \tn % Row Count 26 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Call with \$GLOBALS{[}'TYPO3\_DB'{]}-\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{tslib\_cObj}} \tn % Row 0 \SetRowColor{LightBackground} enableFields (\$table) & Returns \$where params to filter records \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} getSubpart (\$content, \$marker) & Returns a subpart from a template \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} substituteMarker (\$content, \$marker, \$content) & substitute a single marker \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{substituteMarkerArray} (\$content, \$markerArray) & Substitute all markers in the array \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} \seqsplit{substituteMarkerArrayCache} (\$content, \$markers, \$subparts, \$wrapped) & More advanced function. Causes Cache problems \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} stdWrap (\$content, \$conf) & Executes a stdWrap \tn % Row Count 16 (+ 2) % Row 6 \SetRowColor{LightBackground} cObjGetSingle (\$name, \$conf ) & Creates a TS object with the value \$conf \tn % Row Count 18 (+ 2) % Row 7 \SetRowColor{white} whereSelectFromList (\$field, \$value) & Where to search for a value in a CSV list \tn % Row Count 21 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{T3lib\_DIV}} \tn % Row 0 \SetRowColor{LightBackground} makeInstance (\$classname) & Creates an instance of a TYPO3 class \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} tempnam (\$filePrefix) & Create the name of a tempfile \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} unlink\_tempfile ( \$tempfilename) & Removes a tempfile \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{upload\_to\_tempfile} \seqsplit{(\$uploaded\_filename)} & Moves a PHP uploaded file into a TYPO3 temp file \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} \_GET (\$var=null) & Retrieves a GET variable (or the \_GET array) \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} \_POST (\$var=null) & Retrieves a POST variable (or the \_POST array) \tn % Row Count 15 (+ 3) % Row 6 \SetRowColor{LightBackground} \_GPmerged (\$var=null) & Retrieves a GET or POST variable (POST takes priority) \tn % Row Count 18 (+ 3) % Row 7 \SetRowColor{white} intExplode( \$delimeter, \$string ) & Explodes a string, ensuring all values are INT \tn % Row Count 21 (+ 3) % Row 8 \SetRowColor{LightBackground} trimExplode (\$delimeter, \$string) & Explodes a string, trimming all values \tn % Row Count 23 (+ 2) % Row 9 \SetRowColor{white} view\_array ( \$array) & Returns the HTML output of an array \tn % Row Count 25 (+ 2) % Row 10 \SetRowColor{LightBackground} getindpEnv (\$envName) & Returns System Variables like REMOTE\_ADDR \tn % Row Count 28 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{All T3lib\_DIV functions are STATIC. Call by prefixing t3lib\_div::} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{tslib\_pibase}} \tn % Row 0 \SetRowColor{LightBackground} pi\_get\_LL (\$key, \$default) & Retrieves a localized language label \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} pi\_linkToPage (\$str, \$id, \$target, \$params) & Links to a page. Params need Prefix \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} pi\_linkTP (\$str, \$params, \$cache, \$id) & Links to the current page. Params need Prefix \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{pi\_linkTP\_keyPiVars} (\$str, \$pivars, \$cache, \$clear, \$id) & Links to current page, keeping piVars. No Prefix. \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} \seqsplit{pi\_linkTP\_keepPivars\_url} (\$pivars, \$cache, \$clear, \$id) & Same as above, but returns only the URL \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{pi\_list\_linkSingle} (\$str, \$uid, \$cache, \$pivars, \$id ) & Links to the Single View page of the plugin. \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} \seqsplit{pi\_list\_browserresults} (...) & Returns a browse result at bottom \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} pi\_list\_searchBox () & Makes a searchbox \tn % Row Count 20 (+ 1) % Row 8 \SetRowColor{LightBackground} pi\_getRecord (\$table, \$uid) & Retrieves a record of a table \tn % Row Count 22 (+ 2) % Row 9 \SetRowColor{white} pi\_getFFvalue (\$flexform, \$field, \$sheet, \$lang, \$value ) & Allows to extract a value from a FlexForm \tn % Row Count 25 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{This is the base class of front-end plugins} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Typoscript Objects}} \tn % Row 0 \SetRowColor{LightBackground} HTML & Allows to display HTML elements \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} TEXT & Allows to display TEXT (including data elements) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} COA & Allows to show a list of objects \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} COA\_INT & Same as COA, but no caching \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} FILE & Displays the content of a file \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} IMAGES & Displays an image \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} \seqsplit{IMG\_RESOURCES} & Returns the reference to an image \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} CONTENT & Return Content Elements \tn % Row Count 12 (+ 1) % Row 8 \SetRowColor{LightBackground} RECORDS & Return records \tn % Row Count 13 (+ 1) % Row 9 \SetRowColor{white} HMENU & Creates a HMENU \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} IMGTEXT & Display an image with a caption \tn % Row Count 16 (+ 2) % Row 11 \SetRowColor{white} CASE & Like a COA, but displays only 1 \tn % Row Count 18 (+ 2) % Row 12 \SetRowColor{LightBackground} \seqsplit{LOAD\_REGISTER} & Allows to retrieve a PHP value \tn % Row Count 20 (+ 2) % Row 13 \SetRowColor{white} USER & Allows to call a user script \tn % Row Count 21 (+ 1) % Row 14 \SetRowColor{LightBackground} USER\_INT & Same as User but with no caching \tn % Row Count 23 (+ 2) % Row 15 \SetRowColor{white} TEMPLATE & Used to link a template \tn % Row Count 24 (+ 1) % Row 16 \SetRowColor{LightBackground} MEDIA & Return a video or audio player \tn % Row Count 25 (+ 1) % Row 17 \SetRowColor{white} SWFOBJECT & Return a flash object \tn % Row Count 26 (+ 1) % Row 18 \SetRowColor{LightBackground} \seqsplit{GIFBUILDER} & Used with an IMAGE to make an image \tn % Row Count 28 (+ 2) % Row 19 \SetRowColor{white} TMENU & Used with HMENU to make text menus \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Typoscript Objects (cont)}} \tn % Row 20 \SetRowColor{LightBackground} TMENUITEM & Implicitly used with TMENU to make menu items \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}