TYPO3 Markup and Subparts part II

Typo3 is a powerful CMS tool, which is being widely used nowadays. This blog is a part of my daily learning and I will try to document my knowledge here in a very simple way. Sometimes there may be some mistake regarding the contents.

Now let’s move towards our topic from today. I will try to explain what are marks and sub-parts in TYPO3 and how they look like. Both marks and subparts refer to a concept called “markers”. If you are wondering, what is markup, the markup is nothing but a word wrapped in three hast tags(###) on each side.

Example:

###TITLE###
###METANAV###
###DOCUMENT###

MARKS

A mark is a single marker placed in your HTML template. Example:

<h1>###TITLE###</h1>

When this code is interpreted by TYPO3 CMS, it will only parse ###TITLE###. That means ###TITLE### will be replaced with what you configured in TYPO3 CMS. Other HTML code will remain as it is.

However, every time marks placed inside HTML code will not be parsed by TYPO3. This is true when: marks are placed inside HTML comment tag.

Example:

<!--###TITLE###-->

This is wrong.

SUBPARTS

The basic syntax is the same as in marks, but use pairs of markers. Sometimes they can hold some HTML code in between.

Example:

###METANAV###
<p>
        This is HTML code.
        It will be replaced by TYPO3, when we configure the subpart "METANAV".
</p>
###METANAV###

When the template is interpreted by TYPO3 CMS the whole subpart is replaced by whatever was configured to be placed there. Everything around the subpart (above and below) remains untouched.

The other difference of subpart with marks is that subpart can also be placed inside HTML comment tag.

Example:

<!-- ###METANAV### Start -->
<p>
        This is HTML code.
        It will be replaced by TYPO3, when we configure the subpart "METANAV".
</p>
<!-- ###METANAV### End -->

When you open this template file in a browser, they do not show up, but still, TYPO3 CMS will interpret. Additional information is also supported inside the comment tag, such as start and end. The start will indicate the beginning and end will indicate the finish of the subpart as shown below.

Now the question may be, how to name them. Can I put any name? Actually yes. TYPO3 CMS will know how to replace them because there will be the correspondence between the names used in markers and TYPO3 CMS configuration. Truly speaking, marks and subparts have nothing to do with IDs and classes like in HTML and CSS tags. However, it is recommended to create relevant, meaningful and short markers names in your templates.

BE CAREFUL: Marker names will not support space inside them. 

Example:

###MAIN CONTENT###
###SECONDARY HEADER###

These are not VALID markers.

 

Source:TYPO3.ORG

mm

Anup Chhetri

IT system administrator

You may also like...

error: Content is protected !!