Hand-written Includes in-depth notes
Container container
No call site in this site yet
Wrap markup in a container with a maximum width and horizontal padding, which keeps content aligned to the page grid.
container($content = '', $class = '')
Pages Home List pages Detail pages Single pages
How do I read these repository paths?
All paths are relative to the site root. Open core/tpl_blocks.php at line 31 to see the definition of container(). The "core method" is what the tag actually forwards to: a template writes content_list(...) and the core runs Tpl::contentList(...).
1. Fill in parameters, get the code Edit any field and the result below updates instantly; press Copy and paste it into a template. It also works without JavaScript: press Generate and the server recomputes it.
click the title to collapse / expand
Now generating: container
This is the real rendering of the page (real header, container, this tag output, real footer). It reloads when you change a parameter.
Refreshing…
This is the server-computed default; it updates as you edit any parameter and the preview on the right is re-rendered too. It also works without JavaScript: fill the form and press Generate.
2. Full parameter table 2 parameters, one per row; scroll sideways on narrow screens.
click the title to collapse / expand
| Parameter | Type | Default | Description |
|---|---|---|---|
content |
string |
'' | HTML inside the wrapper, printed raw and unescaped; an empty value still renders an empty div. |
class |
string |
'' | Class appended after ry-wrap; omitting it keeps just ry-wrap. |
3. Examples Every example can be copied as-is; the later ones are more advanced.
click the title to collapse / expand
Smallest working call
Prints a grid container whose maximum width follows the theme container variable, with 20px of padding on each side.
<?= container('<p>Welcome to our site.</p>') ?>
Typical usage with a custom class
The class is appended after ry-wrap and carries your own spacing and background rules.
<?php $html = '<h2 class="ry-about__title">' . $about['title'] . '</h2>'; $html .= '<div class="ry-about__body">' . $about['content'] . '</div>'; ?> <?= container($html, 'ry-about__inner') ?>
Advanced: full-bleed background with a contained body
The outer background class spans the viewport while the container only aligns the content to the grid.
<div class="ry-about">
<?= container('<div class="ry-about__grid">' . $cards . '</div>', 'ry-about__inner') ?>
</div>
4. What it does / when to use it
Use it when you assemble pages yourself, such as home page bands, single-page bodies, or mixed text and images, to pull the content into the page grid so neighbouring blocks line up and wide screens do not spread it out. Do not add it around a region that a page skeleton or block skeleton already wrapped, and remember it is a content container rather than a background band: for a full-bleed colour or a full-width image, put the background on an outer element and the container inside it.
5. Which pages it belongs on This is the question clients actually ask: "I am building the home page / a list page / a detail page — which tags do I use?"
click the title to collapse / expand
| Page | What that page is | What this tag does there |
|---|---|---|
| Home | Home page: hero, category blocks, latest content |
On the home page it usually sits in the hero, a category block, or a latest/featured section. You use it to: Use it when you assemble pages yourself, such as home page bands, single-page bodies, or mixed text and images, to pull |
| List pages | Category list pages: listing, filters, pagination |
On a list page it lives in the list container or right next to the pagination bar. You use it to: Use it when you assemble pages yourself, such as home page bands, single-page bodies, or mixed text and images, to pull |
| Detail pages | Content detail pages: body, specs, related items |
On a detail page it goes in the body area or in the related-items sidebar. You use it to: Use it when you assemble pages yourself, such as home page bands, single-page bodies, or mixed text and images, to pull |
| Single pages | One-off pages such as About or Contact |
On a single page (About, Contact) it sits inside the content block. You use it to: Use it when you assemble pages yourself, such as home page bands, single-page bodies, or mixed text and images, to pull |
Clicking a page name jumps to every tag for that page in the reference (the "By page" filter there). This page always shows everything about the tag, whatever that filter is set to.
6. How to use it (step by step)
- Start with container($html): it prints a ry-wrap element that reads the theme container width and adds horizontal padding, and it places the content inside as-is.
- Escape each dynamic fragment before you concatenate, using the template escaping helper for titles and field values, because the tag performs no second escaping pass.
- Pass class for your own spacing or background hook. It is appended after ry-wrap, for example ['class' => 'ry-about__inner'], and the matching rules belong in the pack CSS.
- Build full-bleed layouts by putting the background class on the outer element and leaving the container to align the content, so the background spans the viewport while the text still lines up with neighbouring bands.
- Keep one container per screen region: either wrap both neighbouring bands or neither, because mixing the two makes the content width jump and looks like a broken layout.
7. Common pitfalls
- The content is not escaped, so concatenating visitor input or raw field values into it opens an XSS hole. Run each dynamic fragment through the escaping helper first.
- The factory styles define no spacing utilities: a class such as ry-py-40 does not exist in base.css, so passing it changes nothing and the block ends up with no vertical breathing room. Define the rule for your own class in the pack CSS instead.
- Nesting containers doubles the horizontal padding, 20px plus 20px, and shrinks the content width with it, which most often happens when a page skeleton already wrapped the region.
- The container has no vertical padding of its own, so adjacent bands touch; let the outer element carry the padding, or switch to a block skeleton that ships its own vertical rhythm.
- An empty content string still produces an empty container element, so check for content before you use a container for conditional output.
8. Real rendered output This section was rendered once on the server with this site real data; it is not a mock-up.
click the title to collapse / expand
It outputs a whole page region (this site header / footer / a full layout section, or it decides what to render from the current page data). Inside this small box it would just splice another page skeleton into this one: you would not see its real effect, and it would wreck this page. Copy it into your template instead.
Loading the code…
9. Where it already appears in your templates Grouped by components / page templates / template packs; the data comes from a script scan.
click the title to collapse / expand
No call site for this tag in this site templates yet.