.. include:: /Includes.rst.txt .. index:: PAGE Top-level objects; page .. _page: .. _page-datatype: .. _object-type-page: ==== PAGE ==== This defines what is rendered in the frontend. PAGE is an object type. A good habit is to use :ts:`page` as the top-level object name for the content-page on a website. TYPO3 does not initialize :ts:`page` by default. You must initialize this explicitly, for example:: page = PAGE Pages are referenced by two main values. The "id" and "type". **The "id"** points to the uid of the page (or the alias). Thus the page is found. Most of this code is executed in the PHP script :php:`\TYPO3\CMS\Frontend\Http\RequestHandler`. .. _page_output: Output of the PAGE object ========================= An empty :ts:`PAGE` object without further configuration renders a HTML page like the following: .. code-block:: html Page title This default behaviour can be changed by setting the property :ref:`setup-config-disableallheadercode`:: page.config.disableAllHeaderCode = 1 If the output represents another format different from HTML the HTTP header should also be set, for example:: page.config.additionalHeaders.10.header = Content-type:application/json .. index:: PAGE; typeNum PAGE; Multiple pages Multiple pages ============== The **type** is used to define how the page should be rendered. This is primarily used with different representations of the same content. Your default page will most likely have type 0 while a JSON stream with the same content could go with type 1. When rendering pages in the frontend, TYPO3 uses the GET parameter **"type"** to define how the page should be rendered. This is primarily used with different representations of the same content. Your default page will most likely have type 0 (which is the default) while a JSON stream with the same content could go with type 1. The property :ref:`typeNum ` defines for which type, the page will be used. Example:: page = PAGE page.typeNum = 0 page { # set properties ... } json = PAGE json.typeNum = 1 # ... See :ref:`An example page type used for JSON data ` about an example for the latter page. In the frontend, the original URLs that are generated will include the type and an id parameter (for the page id), example (for json and page id 22): :samp:`/index.php?id=22&type=1` Guidelines ---------- Good, general PAGE object names to use are: * **page** for the main page with content * **json** for a json stream with content * **xml** for a XML stream with content These are just recommendations. However, especially the name page for the content bearing page is very common and most documentation will imply that your main page object is called page. Examples ======== Please see the dedicated example page about examples of how to use the PAGE object: :ref:`page_examples` .. index:: PAGE; Properties Properties ========== .. container:: ts-properties ============================== ===================================== ====================== ======================== Property Data Type :ref:`stdwrap` Default ============================== ===================================== ====================== ======================== `1,2,3,4...`_ :ref:`cObject ` `bodyTag`_ :ref:`data-type-tag` `bodyTagAdd`_ :ref:`data-type-string` `bodyTagCObject`_ :ref:`cObject ` `config`_ :ref:`->CONFIG ` `css\_inlinestyle`_ :ref:`data-type-string` `cssInline.[array]`_ :ref:`cObject ` `footerData.[array]`_ :ref:`cObject ` `headerData.[array]`_ :ref:`cObject ` `headTag`_ :ref:`data-type-tag` / :ref:`stdwrap` `includeCSS.[array]`_ :ref:`data-type-resource` `includeCSSLibs.[array]`_ :ref:`data-type-resource` `includeJS.[array]`_ :ref:`data-type-resource` `includeJSFooter.[array]`_ :ref:`data-type-resource` `includeJSFooterlibs.[array]`_ :ref:`data-type-resource` `includeJSLibs.[array]`_ :ref:`data-type-resource` `inlineLanguageLabelFiles`_ (array of strings) `inlineSettings`_ (array of strings) `jsFooterInline.[array]`_ :ref:`cObject ` `jsInline.[array]`_ :ref:`cObject ` `meta`_ (array of strings) `shortcutIcon`_ :ref:`data-type-resource` `stdWrap`_ :ref:`stdwrap` `typeNum`_ :ref:`data-type-integer` 0 `wrap`_ :ref:`data-type-wrap` ============================== ===================================== ====================== ======================== .. ### BEGIN~OF~TABLE ### .. index:: PAGE; Content objects .. _setup-page-1-2-3-4: 1,2,3,4... ========== .. container:: table-row Property 1,2,3,4... Data type :ref:`cObject ` Description These properties can be used to define any number of objects, just like you can do with a :ref:`COA content object `. The content of these objects will be rendered on the page in the order of the numbers, not in the order they get defined in the TypoScript definition. It is considered best practise to leave space between the numbers such that it will be possible to place objects before and after other objects in the future. Therefore you will often see that people use the number 10 and no number 1 is found. Example :: page = PAGE page.20 = TEXT page.20.value = World page.10 = TEXT page.10.value = Hello This renders to :html:`HelloWorld`. .. index:: PAGE; bodyTag .. _setup-page-bodytag: bodyTag ======= .. container:: table-row Property bodyTag Data type :ref:`data-type-tag` Default Description Body tag on the page Example :: # This will lead to page.bodyTag = .. index:: PAGE; .. _setup-page-bodytagadd: bodyTagAdd ========== .. container:: table-row Property bodyTagAdd Data type :ref:`data-type-string` Description This content is added inside of the opening :html:`` tag right before the :html:`>` character. This is mostly useful for adding attributes to the :html:`` tag. Example :: # This will lead to page.bodyTagAdd = class="example" .. index:: PAGE; bodyTagCObject .. _setup-page-bodytagcobject: bodyTagCObject ============== .. container:: table-row Property bodyTagCObject Data type cObject Description This is the default body tag. It is overridden by :ref:`setup-page-bodyTag`, if that is set. **Note:** Additionally to the body tag properties noted here, there also is the property :ref:`setup-config-disableBodyTag`, which, if set, disables body tag generation independently from what might be set here. .. index:: PAGE; config .. _setup-page-config: config ====== .. container:: table-row Property config Data type :ref:`->CONFIG ` Description Configuration for the page. Any entries made here override the same entries in the top-level object :ref:`config`. .. index:: PAGE; CSS_inlineStyle .. _setup-page-css-inlinestyle: CSS\_inlineStyle ================ .. container:: table-row Property CSS\_inlineStyle Data type :ref:`data-type-string` Description This value is just passed on as CSS. **Note:** To make TYPO3 actually output these styles as *inline* CSS (in-document CSS encapsulated in :html:`