Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Many doubts about TYPO3 template system

I am very new in TYPO3 (I came from Joomla and WordPress) and I am having difficulties in understanding how templates are handled in TYPO3 (it seems to me that the situation is more complex in TYPO3 than it is in Joomla and in WordPress).

I have installed and I am testing this version of TYPO3 introductionpackage-6.1.3.zip

In Joomla and in WordPress a template simply is an HTML structure (which are marked in the various areas of the page where the CMS modules will be placed) and the related CSS settings.

In TYPO3 it seems to me that the situation is very different or am I wrong?

At this moment I am reading this section of the official documentation that references the default template of the TYPO3 Introduction Package: http://docs.typo3.org/typo3cms/GettingStartedTutorial/Templates/Index.html

The difference between static content and dynamic content of a website created using a CMS is pretty clear to me (this is not different from any others CMS like Joomla or WP)

Dynamic content: is something that is dynamically created by the CMS (executing some queries) as a menu (it look into a DB table and then a script renders the menu on the page)

Static content: is something that is fixed as the title of the website or a background image

Until now I think that it is pretty clear for me but I have many doubts when the documentation speaks about the Template Record as a way to implement the previous principle.

Here: http://docs.typo3.org/typo3cms/GettingStartedTutorial/Templates/%28%28generated%29%29/Index.html

it says that:

This is a control element that instructs TYPO3 how to handle a certain branch of the page tree.

In particular with this image it shows how to modify these template records for the Introduction Package Template (Introduction Package is also the name of the template provided with this package or what?):

enter image description here

Then on this section on the documentation it says:

If you edit the template "Introduction Package" you will see that most fields are empty. For each website you need a TypoScript template on the ROOT level, in this case that is the "Introduction Package" template. The TypoScript configuration of a website can be quite long therefore it is possible to make many small TypoScript templates that get included in the main template. For better maintenance, all TypoScript of the Introduction Package has been put into the folder 'Typoscript Templates'. The only thing the "Introduction Package" template does is to include the "ROOT" template that in turn includes other templates.

And this is totaly obscure for me: I have understood that TypoScript is a configuration language that can be used to configure the frontend (so I think that I can use it to configure how my page will appear) but I can't understand the following assertions:

  1. What does this mean: For each website you need a TypoScript template on the ROOT level, in this case that is the "Introduction Package" template ? I have installed TYPO3 Introduction Package and I have only a web site !!! What is the ROOT level of the website? Is it the Welcome to TYPO3 node in the List section Tree? So in pracatice I am assigning a specific template to the root of a website and this is used in all subnodes (all the pages as Home, About TYPO3, Features, etc)?

  2. What does it mean when it says: For better maintenance, all TypoScript of the Introduction Package has been put into the folder 'Typoscript Templates'. Where is this folder? I don't have it.

  3. What does it mean when it says: The only thing the "Introduction Package" template does is to include the "ROOT" template that in turn includes other templates.?

Tnx so much

Andrea

like image 607
AndreaNobili Avatar asked Aug 15 '13 17:08

AndreaNobili


2 Answers

The root level of your website is the page called Home. It also has the globe instead of a normal page icon, because the flag Use as root page is set in the page properties under behavior.

When you access a page in TYPO3 CMS, then it will walk up the rootline until it finds a root page with a template record. In this case, it is indeed a record called Introduction Package, but what is more important, is that this is a record of the type template.

OK, so far we have found a template for your request. Now TypoScript comes into play. On a normal request, the template engine will search for an object named page which is (usually) of the type PAGE. Thus the most simple template is:

page = PAGE
page.10 = TEXT
page.10.value = <h1>Hello World</h1>

Which just prints Hello World on your website.

What happens next depends on your template approach chosen (marker base, automaketemple+marker, templavoila, fluid, fedext, ...). That means that TYPO3 CMS does not just have one template approach (or one kind of template), but is extensible and very flexible, as you can combine them.

In the Introduction Package uses the automaketemplate+markers approach. This includes a ready HTML template, automatically creates blocks based on certain rules and then replaces those blocks with dynamic content.

OK, where do you find the configuration for this? The actual template file is fileadmin/default/templates/introduction_package_site_structure_template.html. The TypoScript configuration is in fileadmin/default/TypoScript. There you can find a file called setup.ts. It includes all other TypoScript files. There are various folders, e.g. menu for the menu definition, block for the dynamic blocks, etc. The configuration of automaeketemplate is in Extension/AutomakeTemplate/setup.ts.

The sections defined with the help of automaketemplate are replaced in Page/setup.ts.

The full TypoScript defines a tree structure of objects with their configuration. You can view the full parsed template with either the Template Analyzer or the TypoScript Object Browser which you find in the template tools in the dropdown select box on top of the module.

The separation of the TypoScript into several files is done by the purpose of the configuration inside the files. This is meant for easy maintenance and not for easy learning. You can always use the Template Analyzer to see the full template that is generated out of the fragments and the TS Object Browser to see what kind of configuration tree this results in.

This might sound a bit difficult at first, especially compared to the primitive template systems of other products, however it gives you great possibilities that are yet easy to maintain, even if you do major updates.

like image 132
pgampe Avatar answered Oct 21 '22 02:10

pgampe


It is great to see that people decide to use TYPO3. In my point of view the biggest difference to WordPress, Drupal...

is the strict separation between HTML and dynamic logic, witch can be TypoScript/userFunc or Fluid logic...

and even this makes TYPO3 so powerful. nothing against WordPress, Drupal... ect. but to use PHP in templates is especially for updates a dangerous thing to do.

I am always impressed whats possible with TYPO3. "I cant do it" is not valid for TYPO3. TYPO§ always has a way.

It is indeed a hard way through to learn all the corners of TYPO3 but it is worth.

Keep doing it and you will succeed

Ludwig

like image 29
user2627170 Avatar answered Oct 21 '22 03:10

user2627170