TYPO3 Markup and Subparts part I

The name of the marks and subparts are now used in the TypoScript template to insert dynamic content into the HTML template.

Having a look at the section on the TEMPLATE object you will notice that there are two properties which hold the configuration for subparts and marks.

Inside the property “subparts” we can define the rendering instructions for our subparts and inside the property “marks” we can define the rendering instructions for the marks.

Now let’s add the following code to the setup of our TEMPLATE object:

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Configuration of SUBPARTS
////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Define the subparts, which are inside the subpart DOCUMENTBODY
page.10.subparts {

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Configuration of MARKS
////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Define the marks inside the subpart DOCUMENTBODY
page.10.marks {

}
typo3-markup-and-subparts-part-i

typo3-markup-and-subparts-part-i

In the next section, we will define the marks and subparts. Do not mix up marks and subparts in a single section. This will stop from rendering.

For each mark and subpart, we will define which content object (cObject) we want to use. Then we configure this content object to produce the output we want.

For each of the marks and subparts, we will rebuild the structure of the HTML code, which we had in our template (index.html). After that, we will have the same structure again, but the actual content in it will be then be generated by TYPO3 CMS based on the pages and their content.

Before we begin defining the first subpart for our meta navigation, let us recap our progress so far: first we have imported a page structure in the TYPO3 CMS Backend (index.html) in /fileadmin/doc_tut_templating/ . TYPO3 CMS will later display these pages. We have modified an HTML template file by adding subparts and marks for everything which should be output dynamically by TYPO3 CMS. Again in the TYPO3 CMS Backend we have created a template record in the root page. Inside that template record we have instructed TYPO3 CMS to load our HTML template and to work with the part between the body tags.

In the next steps, we will sue the cObjects, offered by TYPO3 CMS, to configure the output for each of our marks and subparts. Let’s start with meta navigation.

METANAV suppart

The meta navigation, which will be displayed at the top right corner of the screen, should hold a menu with some pages. We always want the same pages to be at that place ( no matter on which page the use of our website currently is). Two pages “Contact” and “Imprint” will be always there.

Since we basically want to output a menu, we define the subpart METANAV as

page.10.subparts {
METANAV = HMENU

Now using properties of the HMENU objects, we can output all kinds of hierarchical menus.

As a reminder, here is the HTML code that we want to change in our template (index.html) and we want to replace with dynamic text from TYPO3 CMS.

typo3-markup-and-subparts-part-i-1
typo3-markup-and-subparts-part-i-1

Since HMENU object has a wrap property, we can use it to create a <ul> tag around our menu by adding:

METANAV.wrap = <ul>|</ul>

continuous……..

Source: TYPO3.ORG

mm

Anup Chhetri

IT system administrator

You may also like...

error: Content is protected !!