DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Change and editing templates

EXT:arx_accuweather is using fluid as template engine. If you are used to fluid already, you might skip this section.

This documentation won't bring you all information about fluid but only the most important things you need for using it. You can get more information in books like the one of Jochen Rau und Sebastian Kurfürst or online, e.g. at http://wiki.tpyo3.org/Fluid or many other sites.

Change the templates using TypoScript constants

You can use the following TypoScript in the constants to change the paths

plugin.tx_arxaccuweather {
    view {
        # cat=plugin.tx_arxaccuweather/file; type=string; label=Path to template root (FE)
                    templateRootPath = EXT:arx_accuweather/Resources/Private/Templates/
                    # cat=plugin.tx_arxaccuweather/file; type=string; label=Path to template partials (FE)
                    partialRootPath = EXT:arx_accuweather/Resources/Private/Partials/
                    # cat=plugin.tx_arxaccuweather/file; type=string; label=Path to template layouts (FE)
                    layoutRootPath = EXT:arx_accuweather/Resources/Private/Layouts/
    }
}

Layouts, Templates & Partials

If using fluid, the templates are structured by using Layouts, Templates and Partials.

Layouts

Layouts are used to structure the output of a plugin. A simple example is to wrap every output with the same <div> element. Therefore it is not needed to repeat this code and write it only once.

A layout can look this:

<div id="accuweather">
        <f:render section="main" />
</div>

This means that the output of the section main will be rendered inside a div with the id accuweather.

Templates

Every action (like the Weather for the next 4 days for a city, Current temperature for a few cities or Search for a city from a country) needs its own template which can be found at Templates/<Model>/<ActionName>.html.

If Layouts are used, it is required to define the name of the Layout (which is identical to the file name of the Layout file).

<f:layout name="Default" />

<f:section name="main">
        This will be rendered
</f:section>

Partials

Partials are used within templates to be able to reuse code snippets.

Sections

Sections are very similar to partials. The difference is that sections are defined in the same file as the template.