{meta}

The page's metadata - a title, a layout, a cache time or any value - read while the page is assembled.

Layouts and components Single tags

Syntax

{meta title='Title', name=value}
{meta layout='layout', cache=600, access='admin', sitemap=false}

Options

layout
Frames the page with that layout, as {extends} does.
cache
The page's own server-cache time in seconds, in an application with the page cache on; 0 or false keeps the page out of the cache.
access
Kept for access rules to read with padMeta ( 'access' ).
sitemap
false leaves the page out of {sitemap}; read with padMeta ( 'sitemap', 'page' ).
title
Like any other name: becomes the variable $title, which a wrapper's <title> shows.

Description

{meta} says in the template what a page with PHP would say in its .php - so a plain .pad, or an .html file dropped into the application, can set its title or its layout. Like {extends} it is no tag that renders: the {meta} tags are read while the page is assembled - after the PHP of _inits.php and of the page itself, before the template renders - and taken out of the text. Their values are expressions and may use the PHP's variables.

  • layout= frames the page with a layout, exactly as {extends} does.
  • cache= is the page's own cache time in an application whose page cache is on; 0 or false keeps the page out. It is read from the file before the cache is consulted, so only a plain value counts there.
  • access= and sitemap= are kept for others to read: padMeta ( 'access' ) for the page being built, padMeta ( 'sitemap', 'reports/monthly' ) from another page's file; sitemap=false leaves a page out of {sitemap}.
  • Any other name becomes a variable of the page: title= is $title, which the wrapper's <title> shows.

A page may hold more than one {meta}. Every example on this site starts with one - its title and about line are what the indexes show. The tag must stand directly in the page's own template, outside any other tag; anywhere else it is an error under the strict check, as is a name that is not a valid variable name.

Examples

Values for the page

Every name that is not one of the engine's becomes a variable of the page - this line itself is a meta.

Templateexamples/meta/1-values.pad
{meta weight='1.1 kg', price=79 * 1.21}
<p>This example is called <q>{$title}</q>.</p>
<p>The kettle weighs {$weight} and costs € {$price}.</p>
Resultopen alone

This example is called Values for the page.

The kettle weighs 1.1 kg and costs € 95.59.

A layout by meta

layout= does what extends does: the page is framed by the layout, its blocks override the layout's.

Templateexamples/meta/2-layout.pad
{meta layout='_layouts/extendsCard'}
{block 'title'}Framed by meta{/block}
<p>No extends tag on this page.</p>
Resultopen alone

Framed by meta

No extends tag on this page.

Made with PAD

See also

  • {extends} Frames the page with a layout instead of its directories' wrappers.
  • {block} A named region of a layout or wrapper - and a page's override of it.
  • {sitemap} Lists the pages of the application, read from the file tree, as rows with page, url and lastmod.
  • {set} Assigns one or more variables, as globals that outlive the level the tag stands in.