Book Image

Mastering TypoScript: TYPO3 Website, Template, and Extension Development

Book Image

Mastering TypoScript: TYPO3 Website, Template, and Extension Development

Overview of this book

Free, open-source, flexible, and scalable, TYPO3 is one of the most powerful PHP content management systems. It is well suited for creating intranets and extranets for the enterprise. While providing an easy-to-use web interface for non-technical authors and editors of content, its messaging and workflow system enable shared authoring and collaboration. TYPO3 provides flexible and powerful interfaces for both content editors and administrators, giving them full control of the core aspects the system. However for developers who need to customize the system, TYPO3 offers a powerful configuration language called TypoScript. Good knowledge of TypoScript is really a prerequisite for implementing complex applications with TYPO3 and gives developers full control over the configuration of TYPO3 and its template engine. TypoScript enables the complete output template to be created and manipulated, giving you full control over the layout of the site. TypoScript also allows you to integrate dynamic contents, JavaScript-based menus, Flash, Graphics, etc. with ease. You have maximum control over the design of the website and can control all options that would otherwise be addressed by HTML-simple text output, formatting, and much more. TypoScript also allows you to generate graphics at run time and display different content dynamically.
Table of Contents (19 chapters)
Mastering TypoScript: TYPO3 Website, Template, and Extension Development
Credits
About the Author
Preface

Object Reference


CONTENT

This object is used to insert contents from the database into the pages. The two properties select and table define exactly where this content comes from.

select

You can engage in an SQL query with this.

Syntax:

select = string (select-Statements)

Example:

select.orderBy = sorting

table

Specifies the database table from which the contents are to be read out. pages or tables with the prefixes fe_, tt_, ttx_ and user_ are permitted.

Syntax:

table = string (Table name)

Example:

table = tt_content

EDITPANEL

An edit toolbar is inserted in the front-end view for editors so they can make changes to the site. A pre-requisite for that is that the editors are logged in as back-end users.

allow

Defines the functions that can be accessed. If several functions are allowed, a comma-separated list is used. These values can be used: delete, edit, hide, move, new, and toolbar.

Syntax:

allow = string

Example:

allow = new, delete

label

Defines the title of the edit panel. The title of the content can be inserted with %s.

Syntax:

label = string

Example:

label = You are editing dataset %s

line

If this value is set, a line is displayed after the edit panel. This value defines the space between the edit panel and the line. If you enter 0 no line is displayed.

Syntax:

line = boolean / int

Example:

line = 1

newRecordFromTable

Displays a panel for the creation of a new dataset for the specified table.

Syntax:

newRecordFromTable = string

Example:

newRecordFromTable = pages

onlyCurrentPid

If this property is set to 1, only those datasets that have the appropriate PID for the current ID, in other words only those that are actually on the current page, are provided with an edit panel.

Syntax:

onlyCurrentPid = boolean

Example:

onlyCurrentPid = 1

previewBorder

When you set this property, the elements endtime, fe_user, hidden, and starttime are provided with a border. The thickness of the border can be defined with an integer value.

Syntax:

previewBorder = boolean / int

Example:

previewBorder = 2

FILE

This specifies the files that are to be integrated.

altText, titleText

Defines the alt- and/or the title attribute of the<img> tag.

Syntax:

altText = string

Example:

altText = My Image

file

The contents of the specified file are directly passed to the HTML code. If, however, this file is a resource of the gif, jpg, jpeg, or png type, the image is integrated as an<img> tag.

Syntax:

file = string (Resource)

Example:

file = fileadmin/_temp_/logo.png

longdescUrl

If the specified file is a graphic, the longdesc attribute can be assigned to it with a respective value. Behind the specified URL is a file that contains a textual description of the graphic.

Syntax:

longdescUrl = string (Resource)

Example:

longdescUrl = longer-longdesc.html

HRULER

This property produces a line.

Property

Description

lineColor

Line color

lineThickness

Line thickness

spaceLeft

Distance from the line on the left edge

spaceRight

Distance from the line on the right edge

tableWidth

Line width

IMAGE

Graphics are integrated with this.

altText, titleText

The alt and title attributes of the<img> tag are defined with these.

Syntax:

altText = string

Example:

altText = My Graphic

border

Defines the property of the border attribute of the<img> tag.

file

Defines the path to the graphic file that is to be integrated.

Syntax:

file = string (Resource)

Example:

file = fileadmin/_temp_/logo.jpg

longdescURL

The longdesc attribute can be assigned to the<img> tag with this. The expected value is an appropriate info file that describes the graphic in detail.

Syntax:

longdescURL = string (Resource)

Example:

longdescURL = fileadmin/_temp_/more_infos.htm

params

This allows you to set additional parameters for the<img> tag.

Syntax:

params = string (Attribute)

Example:

params = class="news"

CLEARGIF

With CLEARGIF you set up a transparent GIF file that is normally used for the positioning of elements.

Height

Defines the height of the integrated transparent GIF file.

Syntax:

height= integer

Example:

page.20.height = 8

width

Defines the width of an integrated transparent GIF file.

Syntax:

width= integer

Example:

page.20.width = 10

IMAGE_RESOURCE

Use IMAGE_RESOURCE to integrate the path to an image file into a template; this does not produce an<img> tag. This is, for example, useful when assigning a background image to a table.

file

Defines the path to the image file to be integrated.

Syntax:

page.int = IMAGE_RESOURCE

Example:

page.20 = IMAGE_RESOURCE page.20.file = fileadmin/img/grafi.gif

PAGE

The PAGE object has an important function in TypoScript. It is used to define page objects that are displayed in the front end.

1, 2, 3, 4...

Defines the order in which the elements of a page are to be output. These elements are normally defined in the tens so that additional elements can be inserted later.

Syntax:

page.int

Example:

page.10 = TEXT

bgImg

Defines the background graphic for the page. The image that is defined here is automatically inserted into the<body> tag of the page.

Syntax:

bgImg = string (Resource)

Example:

bgImg = fileadmin/_temp_/back.gif

bodyTag

Defines the<body> tag of the page.

Syntax:

bodyTag = string

Example:

bodyTag = <body style="margin:0; background:#ffffff;">

bodyTagAdd

Appends additional attributes to the<body> tag.

Syntax:

bodyTagAdd = string

Example:

bodyTagAdd = onload="HTMLArea.replaceAll();"

bodyTagMargins

Assigns the leftmargin, topmargin, marginwidth, and marginheight attributes to the<body> tag. The single specified value is used for all four attributes. If you want to create XHTML-compatible documents, use the useCSS = 1 property. This achieves a CSS declaration of the body {margin} scheme.

Syntax:

bodyTagMargins = int

Example:

bodyTagMargins = 3

config

You can configure the page with this.

headerData

With this property you can integrate your favorite data such as CSS, JavaScript, or meta tags into the header area of the page.

Syntax:

headerData = string (Carray)

Example:

headerData.10 = TEXT page.headerData">headerData.10.value = <script type="text/javascript" src="fileadmin/news.js" language="JavaScript"></script>

includeLibs

PHP files can be included with this.

Syntax:

includeLibs = string (Resource)

Example:

includeLibs = fileadmin/_temp_/news.php

meta

You can insert meta statements into the page with this.

Syntax:

meta.string(Meta-Tag) = string (Attribute)

Example:

meta.keywords = fish, fishing, pike

shortcutIcon

Permits the definition of a favicon for the page. The specified file has to be a favicon with the extension *.ico.

Syntax:

shortcutIcon = string (Resource)

Example:

shortcutIcon = fileadmin/_temp_/icon.ico

typeNum

Defines the page ID of the page. This property must be set and can only be assigned once.

Syntax:

typeNum = int

Example:

typeNum = 10

PAGE and Stylesheet Specifications

admPanelStyles

CSS is assigned to the admin panel.

Syntax:

admPanelStyles = boolean

Example:

admPanelStyles = 1

CSS_inlineStyle

The contents of the passed character string are inserted directly into the<style> tag as an inline style sheet.

Syntax:

CSS_inlineStyle = string

Example:

CSS_inlineStyle = a:link {font-family:arial;font-size:10pt;color:#000000; text-decoration:none;}

hover

Defines the color of the hyperlink that appears when the mouse cursor rolls over it. This property is normally no longer used. It is better to define the hover property directly with CSS.

Syntax:

hover = string (color value)

Example:

hover = #cccccc

hoverStyle

Additional properties can be assigned to a hover link with this.

Syntax:

hoverStyle = string

Example:

hoverStyle = font-family:arial

includeCSS.[array]

You can insert stylesheets into the header area of the page with this. And you can integrate more than one file with this. The available parameters are media (sets the media attribute of the<style> tags), alternate (the rel attribute), title (the title attribute), and import (stylesheet is imported with @).

Syntax:

includeCSS = string (Resource)

Example:

includeCSS { file1 = fileadmin/_temp_/news.css file2 = fileadmin/_temp_/news_news.css file2.media = print }

insertClassesFromRTE

If the value of this property is set to 1, the CSS specifications that are defined in the Tsconfig field are added to the stylesheet specifications of the page.

Syntax:

insertClassesFromRTE = boolean

Example:

insertClassesFromRTE = 1

noLinkUnderline

None of the links in the document are underlined. This is accomplished by the automatic insertion of an inline CSS.

Syntax:

noLinkUnderline = boolean

Example:

noLinkUnderline = 1

smallFormField

Form fields such as single-line and multiple-line input fields are rendered in font size 1 and font type Verdana. An appropriate inline stylesheet is inserted into the page for that.

stylesheet

Inserts a link to a stylesheet file of the type<link rel="stylesheet" href=""> into the header area of the page.

Syntax:

shortcutIcon = string (Resource)

Example:

shortcutIcon = fileadmin/_temp_/news.css

TEMPLATE

Defines the template code.

markerWrap

Specifies the syntax that the marker is to be wrapped with.

Syntax:

markerWrap = string (Wrap)

Example:

markerWrap = ###|###

marks

This is an array of markers.

Syntax:

marks[Marker] = string

Example:

marks.CONTENT = TEXT

subparts

This is an array of sub-part markers.

Syntax:

subparts.[Subpart] = string

Example:

subparts.CONTENT = TEXT

template

By default, an object is specified with this in which the design template is defined. Usually the FILE object is used here.

Syntax:

template = string

Example:

template = FILE template.file = fileadmin/hello.htm/

workOnSubpart

A partial area of the design template can be accessed again with this property.

Syntax:

workOnSubpart = string

Example:

workOnSubpart = DOCUMENT

CONFIG

This allows you to configure TYPO3.

admPanel

Enables the admin panel in the footer of the page. This panel also has to be set up for the user in the respective TSConfig.

Syntax:

admPanel = boolean / admPanel-Properties

Example:

admPanel = 1

cache_periode

You can define how long the page is to be kept in the cache in seconds.

Syntax:

cache_periode = integer

Example:

cache_periode = 86400

headerComment

The specified character string is inserted into the<head> area before the Typo3 Content Management Framework comment.

Syntax:

headerComment = string

Example:

headerComment = My Company

includeLibrary

Permits the inclusion of a PHP file.

Syntax:

includeLibrary = string

Example:

includeLibrary = template/my.php

index_enable

Cached pages are indexed with this.

Syntax:

index_enable = boolean

Example:

index_enable = 1

index_externals

This indexes external media that the page links to.

Syntax:

index_externals = boolean

Example:

index_externals = 1

local_all

PHP setlocal function. Additional information about this function can be found at http://www.php.net/manual/en/function.setlocale.php.

Syntax:

local_all = string

Example:

local_all = de_DE

message_preview

This alternative text is displayed when the preview function is enabled.

Syntax:

message_preview = string

Example:

message_preview = Is enabled!

no_cache

If you enable this property, the pages are no longer cached. This means that the pages have to be generated anew with every call from the front end, which will lead to extreme performance losses.

This option should not be enabled in a production environment. It is only useful, for example, when developing a TYPO3 presence so that you don't have to empty the cache all of the time.

Syntax:

no_cache = boolean

Example:

no_cache = 0

notification_email_urlmode

Line wraps of URLs that are longer than 76 characters can be avoided in text emails with this.

Possible values are: all (all HTTP links are converted), a blank value (all links remain unchanged) and 76 (all links that are longer than 76 characters are stored in the database and a hash is sent to the index.php script using the GET variable RDCT=[md5/20]; this script reads the link from the database and effects automatic redirection.).

Syntax:

notification_email_urlmode = string

Example:

notification_email_urlmode = 76

simulateStaticDocuments

Static pages can be simulated with this property and URL rewriting can be enabled. With this, TYPO3 no longer creates the usual hyperlinks such as index.php?id=129, but links like 129.html instead. In order for this to work, you have to extend the .htaccess file with the following entry:

RewriteEngine On
RewriteRule ^[^/]*\.html$ index.php

Syntax:

simulateStaticDocuments = string [PATH_INFO] / boolean

Example:

simulateStaticDocuments = 1

simulateStaticDocuments_addTitle

This property adds the first three characters of the title of the statically simulated files to the URL. You can enter an integer value that defines how many characters of the title are to be used for that. For example, if the value is set to 3, then the URL could read sta.129.html.

Syntax:

simulateStaticDocuments_addTitle = string

Example:

simulateStaticDocuments_addTitle = 3

simulateStaticDocuments_noTypelfNoTitle

Set this value if you do not want the type to be included in the file name.

Syntax:

simulateStaticDocuments_noTypelfNoTitle = boolean

Example:

simulateStaticDocuments_noTypelfNoTitle = 1

simulateStaticDocuments_pENC

Permits the coding of additional parameters in simulated file names.

Syntax:

simulateStaticDocuments_pENC = string [base64, md5]

Example:

simulateStaticDocuments_pENC = base64

simulateStatic Documents_dont RedirectPathInfoError

This property affects the PATH_INFO mode. When this property is set, an error message is always generated when PATH_INFO hasn't been configured properly.

Syntax:

simulateStatic Documents_dont RedirectPathInfoError = string

Example:

simulateStatic Documents_dont RedirectPathInfoError = 192.168.0.34

spamProtectEmailAddresses

All email addresses are encrypted with this property. That way they cannot be read by email robots. The encryption is kept quite simple. For instance, if the value is set to 3, all characters are increased by 3.

Syntax:

spamProtectEmailAddresses = boolean /-5 bis 5

Example:

spamProtectEmailAddresses = 3

spamProtectEmailAddresses_atSubst

Defines a substitution sting for the @ character.

Syntax:

spamProtectEmailAddresses_atSubst = string

Example:

spamProtectEmailAddresses_atSubst = (at)

stat

You can enable recording for statistical purposes with this.

Syntax:

stat = boolean

Example:

stat = 1

stat_excludeBEuserHits

The page hits from registered back-end users will not be recorded.

Syntax:

stat_excludeBEuserHits = boolean

Example:

stat_excludeBEuserHits = 1

stat_excludeIPList

If the IP address is included in this string, the page hits are not recorded.

Syntax:

stat_excludeIPList = string

Example:

stat_excludeIPList = 192.168.0.34

stat_mysql

This enables the recording of log data into the sys_stat database table.

Syntax:

stat_mysql = boolean

Example:

stat_mysql = 1

stat_apache

This enables the recording of log data into the file specified by stat_apache_logfile.

Syntax:

stat_apache = boolean

Example:

stat_apache = 1

stat_apache_logfile

This property specifies the file into which the log data are to be recorded.

Syntax:

stat_apache_logfile = [Filename]

Example:

stat_apache_logfile = mylog.txt

sys_language_uid

You can specify the UID of a website language with this. An integer value to the UID is set in the sys_language table.

Syntax:

sys_language_uid = int

Example:

sys_language_uid = 1

titleTagFunction

The default<title> tag is passed to this function.

Syntax:

titleTagFunction = Functionname

Example:

titleTagFunction = user_pagetitle_class->changetitle