1.13. Appendix D – index.php

Introduction

index.php is the main script for showing pages with TYPO3 / TypoScript. This page provides some information about this script and how to use it.

Normally you request pages by setting a value for "id" and possibly for "type".

"id" refers to a page. This is an integer. If a string is supplied, it's regarded as an alias and the corresponding page is found.

"type" defines which "type" the page is of. It is always an integer (0-255). If "type" is not set, it's regarded to be zero. "type" is used to build framesets. For example the frameset could have "type=0" (or nothing) and the pages in the various frames could have "type=1" and "type=2" and "type=3". In TypoScript you define a PAGE-object for each type so TYPO3 renders different pages depending on the type-value. Normally the PAGE-object displaying the page content is named "page" and has the "type=1" value.

Submitting data to index.php

You can submit data to index.php for several reasons. These are the standard features included in the script:

Login/Logout:

Detected by class "t3lib_userauth" looking for the var "logintype". If this is set, authentication is done.

Input may be of both GET and POST method.

Login:

logintype = "login"

pass = the password

user = the username

pid = the id of the page where the user-archive is found. You don't need this value if $TYPO3_CONF_VARS['FE']['checkFeUserPid'] is set.

(redirect = Not used)

Logout:

logintype = "logout"

See the cObject FORMS for an in-depth description

Search

Detected by the cObject SEARCHRESULT, which proceeds with a search if "sword" && "scols" are set. The search MUST submit to a page with such a content-object on it!

Input may be of both GET and POST method.

Search:

sword = the searchwords

stype = the search type

scols = the tables/columns to search

locationData = Reference to the record carrying the form. Used to look up the original startingpoint of the search (ONLY POST-method)

(redirect = Not used)

scount = Used by the searchresult to indicate the number of results

spointer = Used by the searchresult to indicate the startingpoint for the next number of results.

See the cObject SEARCHRESULT for a complete description.

Emailforms

Detected by the mainscript "index.php" looking for the var "formtype_mail" to be set (could be the submit-button).

Input MUST be POST method. And the REFERER and HTTP_HOST must match. Also the locationData var must be sent and at least point to the uid of a readable page.

Database-submit

Detected by the mainscript "index.php" looking for the var "formtype_db" to be set. (could be the submit-button)

Input MUST be POST method. And the REFERER and HTTP_HOST must match. To setup a script to handle the input, refer to the FE_DATA object.

See examples from the typo3/sysext/cms/tslib/media/scripts/ folder, e.g. "guest_submit.inc".