Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.3. Configuration

This chapter describes how you get the new options inside your own extension. This chapter won't describe how to create an extension!

Adding the options to your extension

There are 2 possible places for the options.

To the Constant Editor

To add the options to the Constant Editor you either add the code to the ext_typoscript_constants.txt file in the root directory of your EXT or you use the static TS file.

You can find the demo file inside the directory static.

To the settings inside the Extension Manager

To add the options to the Extension Manager, you need to place the code inside the ext_conf_template.txt file.

You can find the demo file with the same name inside the root directory of the extension.

General settings

All new options are configured in nearly the same way.

A typical input field would look like

# cat=basic;type=int[0-800]; label=With of something: Set the width of something
width = 470

How to call it

To get to the new options, you need to add the following snippet to the 1st line:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->XXXXXX];

  1. It doesn't matter at which position but important is that every section ends with a ;

  2. XXXXXX needs to be replaced with the correct name of the option. Please take a look at the next sections to get to know more about it.

Specific settings

Most of the new options can be configured by adding a snippet like this to the 1st line.

settings=key1:value1,key2:value2,key3:value3 

Read the next sections about the details

Option “Textarea”

The textarea allows you to save multiple lines instead of the boring input option.

It is called by using:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->textarea];

Options

All options are optional and can be used to style the textarea with any css code you know (and which works with textareas). Those are just examples:

Key:

Example for the value

Description:

width

300px

Width of the textarea

height

50px

Height of the textarea

Important

Because of the postprocessing of the data it is not possible to save linebreaks! Therefore they are changed to '#####' before saving (by using JS) and back before showing them on the page! So you need to explode by '#####'.

Option “Page selector”

Be able to let the users select a page from the page tree instead of typing the ID of the page into an input field.

It is called by using:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->page];

Options

Key:

Example for the value

Description:

formName

tsStyleConfigForm

Set the name of the form in which the page selector is used. If you are using this option inside the extension managers settings, set it to tsStyleConfigForm, otherwise it can be empty. Default is “editForm”

Option “Record list”

Be able to render any resultset of a table as a select field to let the user pick a specific record.

It is called by using:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->recordList];

Options

The only required option is the name of the table. All others are optional:

Key:

Example for the value

Description:

table

pages, tt_content

Table name

where

Name!=””, ...

Where clause

orderBy

Name desc, name asc, uid,...

Order by

limit

2,10,100,1000,...

Limit the result set

Option “Image”

This option is mainly interesting inside the extension managers settings to display an image which can help the user with his decisions.

It is called by using:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->image];

Options

Only one option and this is required.

Key:

Example for the value

Description:

file

fileadmin/fo/abc.gif, typo3conf/ext/foobar/abc.gif

Path to the image

Option “Iframe”

Like the image you can use this option to include a help page which could be a normal frontend page or a static HTML page from somewhere else or whatever you want to have.

It is called by using:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->iframe];

Options

All options are the same as the attributes of the HTML object iframe (besides the https). No limitation.

Key:

Example for the value

Description:

src

www.typo3.org, www.yourdomain.com/help.html

Don't use the http:// there and start with the www. or withozt it. If you need https, take a look at the next line

https

0 or 1

If 1, the url will be prepended with https://, otherwise with http://

width

200, 30,..

Width of the iframe

height

200, 300

Height of the iframe

Option “HTML”

Use this option to display plain HTML code to do whatever you want.

It is called by using:

type=user[EXT:constantsextended/class.tx_constantsextended.php:&tx_constantsextended->html];

Important

You need to be aware that you can't use any of the following characters: : , ;

If you still need those, for example to set a class or whatever, you need to replace them first with something else. It will be replaced to the original character before output.

Original character:

Should be

:

#58#

;

#59#

,

#44#

Options

There is one option which is required

Key:

Example for the value

Description:

code

<h1>Foo</h1>

Your HTML code

Other options

If you need other things, write to me or much better: Do them yourself and send me a patch!