{stack}
Prints everything pushed to a named stack, from above or below it in the page.
Syntax
{stack 'name'}
Parameters
-
name - The name of the stack, required.
Description
{stack 'name'} prints the text that {push} tags added to the stack of that name, in the order they were pushed. The tag itself only prints a marker; the marker is filled in once the whole page has rendered. So a {stack} in the wrapper's <head> gets the pushes of every component further down, and a stack below a push and a stack above it get the same text.
A stack nothing was pushed to prints nothing. From PHP, padStackPush ( 'scripts', $html ) adds to a stack like a {push} does. A {stack} without a name is an error under the strict check.
{toc} works with the same kind of marker, filled in after the page has rendered.
Examples
A stack above its pushes
The stack stands first, the pushes come after it - it still holds them all, in push order.
<p>Stylesheets this page needs:</p>
<ul>{stack 'stackStyles'}</ul>
<p>The page's components follow.</p>
{push 'stackStyles'}<li>tabs.css</li>{/push}
{push 'stackStyles'}<li>chart.css</li>{/push}
Stylesheets this page needs:
- tabs.css
- chart.css
The page's components follow.
An empty stack
A stack nothing was pushed to prints nothing.
<p>Before [{stack 'stackNothing'}] after.</p>
Before [] after.
See also
- {push} Renders its content and adds it to a named stack, for a stack tag elsewhere in the page to print.
- {toc} A table of contents of the page from its own rendered headings, nested and linked - filled in once the page has rendered.
- {cache} Keeps a named section of the page rendered for a number of seconds - the fragment cache.