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

Functions


Date and Time Functions

date

Formats the entered date to the desired format. You can get a list of the options at http://www.php.net/manual/de/function.date.php.

Syntax:

date = string

Example:

date = j, n, Y

strftime

Formats an entered date according to the local settings. You can use all of the allowed conversion specifiers in the strftime()PHP function. For a complete description of the PHP function go to http://www.php.net/manual/en/function.strftime.php.

Syntax:

strftime = string

Example:

strftime = %A, %d. %B %Y

if

directReturn

If this property is set, a true/false value is automatically returned.

Syntax:

directReturn = string

Example:

directReturn = true

equals

Returns true if the content is identical to the value of equals.value.

Syntax:

equals = string

Example:

if { value.data = leveluid:1 equals.field = uid }

isFalse

If the content is false, isFalse will be used no matter what is below.

Syntax:

isFalse = string

Example:

if.isFalse.numRows{ table=pages select.pidInList.data = leveluid:-1 }

isGreaterThan

Returns true if the content is greater than the value of isGreaterThan.value.

Syntax:

isGreaterThan = string

Example:

isGreaterThan.numRows.table < subparts.LEFT.table

isLessThan

Returns true if the content is less than isLessThan.value.

Syntax:

isLessThan = string

Example:

if.isLessThan.field = imageorient

isInList

Returns false if the content does not occur in the list defined by isInList.value.

Syntax:

isInList = string

Example:

if.isInList.data = field:uid

isPositive

If the content is a positive number, true is returned.

Syntax:

isPositive = string

Example:

isPositive = 2

isTrue

Returns true if the content is true.

Syntax:

isTrue = string

Example:

if.isTrue.numRows < styles.content.getRight

negate

The returned result is negated.

Syntax:

negate = boolean

Example:

negate = 1

value

Specifies the standard value.

Syntax:

value = string

Example:

value = 10

imageLinkWrap

This object encloses an image with a link to the showpic.php script. You can specify width, height, background color, and other parameters of the new window.

bodyTag

Defines the<body> tag of the new window.

Syntax:

bodyTag = string

Example:

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

effect

Defines the effect to be used. You can use any of the possible GIFBUILDER values.

Syntax:

effect = see GIFBUILDER

Example:

effect = gamma=1.3

enable

The image is only used if this property is set to 1.

Syntax:

enable = boolean

Example:

enable = 1

height

Defines the height of the image. If m is appended to the value, the proportions of the image are maintained, with height then representing the maximum height.

Syntax:

height = int (1-1000)

Example:

height = 200

JSWindow

The image is opened in a new window that has the same dimensions as the image.

Syntax:

JSWindow = boolean

Example:

JSWindow = 1

JSWindow.altURL

The window is normally displayed by the showpic.php file, but you can assign a different script to the JSWindow.altURL property.

Syntax:

JSWindow.altURL = string

Example:

JSWindow.altURL = mypic.php

JSWindow.expand

The dimensions of the new window can be increased to be larger than the image by the values x and y.

Syntax:

JSWindow.expand = x,y

Example:

JSWindow.expand = 20,40

JSWindow.newWindow

Each image is displayed in a new window.

Syntax:

JSWindow.newWindow = boolean

Example:

JSWindow.newWindow = 1

target

The target attribute with the respective value is assigned to the<a> tag.

Syntax:

target = string

Example:

target = _blank

title

A page title is assigned to the new window.

Syntax:

title = string

Example:

title = My new window

width

Defines the width of the image. If m is appended to the value, the proportions of the image are maintained, with width then representing the maximum width.

Syntax:

width = int (1-1000)

Example:

width = 100

wrap

Wraps the image defined within the<body> tag into the specified HTML syntax.

Syntax:

wrap = wrap

Example:

wrap = <table style="padding-top:1px;" cellspacing="0" cellpadding="0" border="0">|</table>

parseFunc

This function is used to parse content with special TYPO3 tags.

allowTags

A list of tags that are permitted in the code.

Syntax:

allowTags = string

Example:

allowTags = b,i,img

constants

The constants in the text that are defined at the top level are replaced by the specified value. In the following example, every occurrence of ###EMAIL### is replaced by the specified email address.

Syntax:

constants = string

Example:

constants.EMAIL = [email protected]

denyTags

HTML tags that are not allowed in the code can be specified in a comma-separated list.

Syntax:

denyTags = string

Example:

denyTags = font, div

makelinks

If this property is set to 1, any content that is prepended with http:// or mailto: is transformed to a hyperlink.

Syntax:

makelinks = boolean

Example:

makelinks = 1

short

You can define abbreviations with this. In the following example, every occurrence of the word Claim is replaced with A beautiful day. Whenever a Link appears, a hyperlink is defined.

Syntax:

value = string

Example:

short { Claim = A beautiful day Link = <a href="http://www.myhost.de">Page</a> }

tags

Allows you to define your own HTML tag.

Syntax:

tags = string

Example:

parseFunc.tags.myTag = TEXT parseFunc.tags.myTag. { current = 1 wrap = <i>|</i> }

select

This object creates an SQL query with which you can determine what datasets will be read out from the database.

andWhere

Extends a WHERE clause that is defined under where by one more condition.

Syntax:

string (SQL:Where / wrap)

Example:

andWhere.wrap = sys_language_uid = |

begin

The SQL query will start at the dataset specified here.

Syntax:

begin = integer

Example:

begin = 5

join, leftjoin, rightjoin

Defines a respective table name for JOIN, LEFT OUTER JOIN, and RIGHT OUTER JOIN.

Syntax:

join = string

Example:

join = tt_content ON tx_news_rt.pid=tt_content.pid

languageField

This property is used with multilingual pages. When it is set, it points to the field in the dataset that represents a reference to a dataset in the sys_language table.

Syntax:

languageField = string

Example:

languageField = sys_language_uid

max

Only the specified maximum number of datasets will be output.

Syntax:

msx = integer

Example:

max = 3

orderBy

Corresponds to the SQL statement Order by and sorts the datasets according to the specified field.

Syntax:

orderBy = string

Example:

orderBy = sorting, title

pidInList

A comma-separated list of parent IDs is specified with this.

Syntax:

pidInList = string/int

Example:

pidInList = 120,86

selectFields

This property specifies the fields to be selected.

Syntax:

selectFields = string

Example:

selectFields = media

uidInList

This specifies a list of unique IDs.

Syntax:

uidInList = string

Example:

uidInList = 12,97

where

The WHERE clause can be extended by one more condition with this property in order to get more accurate queries.

Syntax:

where = string

Example:

where = colPos = 0 AMD CType='text'

tableStyle

Use this function to create tables. The statements extend the<table> tag by the respective HTML attributes.

align

Alignment of the table.

Syntax:

align = string

Example:

align = My Company

border

Defines the table's border width.

Syntax:

border = int

Example:

border = 2

cellspacing

Defines the spacing between individual cells.

Syntax:

cellspacing = int

Example:

cellspacing = 3

cellpadding

Defines the inside spacing of individual cells.

Syntax:

cellpadding = int

Example:

cellpadding = 4

params

Allows you to assign additional attributes with appropriate values to the<table> tag.

Syntax:

params = <table>-Attribute

Example:

params = width=100%