layout()

Select a HTML layout based on labels. Use the label from the internet address (URL) or from parameters. The layout with the most corresponding labels is chosen.

parameters

label="..."
select HTML layout with label. Only one label is allowed.

single="..."
add label to labels if label from url has one article

multiple="..."
add label to labels if label from url has more than one article

inherit="1"
add parent labels from selected labels

description

layout() is used to select a HTML layout based on labels. HTML layouts can have one or more labels. Use layout() in the master "page.html" to select different HTML layouts based on labels. It can also be used in HTML layouts te select other HTML layouts.

To differentiate between a detail page and an overview page (i.e. news overview and a news article) you can use the parameters single and multiple. If the label from url points to one article the HTML layout with the label of single is used. If the label from url points to more articles label of multiple is used (see example below).

Use of the inherited parameter. If you have a nested label structure, for example for all products in a webshop, you can make an HTML layout for specific for webshop products. The url can point to a sublabel of "webshop" (webshop.products.jeans). When inherited="1" all parent labels (including "webshop") wil be used in the search for the matching HTML layout.

layout selection

Labels are collected from the internet address (url) and when used from the parameters label, single, multiple and inherit. The layout with the most corresponding labels is selected. If there are layouts with the same number of corresponding labels, the layout with less labels is selected.

examples

layout(label="article")

//setup://
HTML layout "article" with label: "layout.article"
HTML layout "news-article" with labels: "layout.article" and "menu.news"
article "about us" and first label "menu.about us" -> url = about-us -> select HTML layout "article".
article "more-space-agencies" and first label "menu.news" => url = news/more-space-agencies -> select HTML layout "news-article"

//url and selected HTML layout://
your-website.nl/about-us -> select HTML layout "article"
your-website.nl/news/more-space-agencies -> selec HTML layout "news-article"


layout(single="article", multiple="overview")

//setup://
HTML layout "article" with label "layout.article"
HTML layout "overview" with label "layout.overview"
article "more-space-agencies" with label "menu.news"
article "for-a-better-climate" with label "menu.news"

url and selected HTML layout://
your-website.nl/news/more-space-agencies ->
select HTML layout "layout.article"
your-website.nl/news -> select HTML layout "layout.overview"


layout(label="article", inherit="1")

setup
HTML layout "webshop" with label "webshop"
HTML "article" width label "article".
article "about us" -> select HTML "article"
artricle: "watches" with label "webshop.products.watches"

url and selected HTML layout://
your-website/about-us -> select HTML layout "article"
your-website/webshop/products/watches -> select HTML layout "webshop"