Hand-written Includes in-depth notes
Page Layout page_layout
Used in page templates
Two-column skeleton of main content plus sidebar that collapses to a single full-width column when the sidebar is empty.
page_layout(array $options = [])
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 63 to see the definition of page_layout(). 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: page_layout
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 3 parameters, one per row; scroll sideways on narrow screens.
click the title to collapse / expand
| Parameter | Type | Default | Description |
|---|---|---|---|
main |
string |
'' | Main column HTML, inserted raw into .ry-layout__main with no re-escaping. |
sidebar |
string |
'' | Sidebar HTML; empty gives a full-width single column. The fragment must bring its own <aside class="ry-sidebar"> wrapper. |
class |
string |
'' | Class appended to .ry-layout; the main and sidebar columns have their own options. |
3. Examples Every example can be copied as-is; the later ones are more advanced.
click the title to collapse / expand
Minimal
Main column only, rendered as a single full-width column, which is enough to get a detail page skeleton working.
<?= page_layout(['main' => $mainHtml]) ?>
Common: two-column list page
The sidebar fragment brings its own aside wrapper, and the list plus pager stay in the main column, so the page has one content width.
<?php $mainHtml = '<div class="ry-list">' . $listHtml . $pagerHtml . '</div>'; $sidebarHtml = '<aside class="ry-sidebar">' . $widgetsHtml . '</aside>'; ?> <?= page_layout(['main' => $mainHtml, 'sidebar' => $sidebarHtml]) ?>
Advanced: one template, two layouts
ry-detail-wide is a class from your own template pack and needs its own CSS; an empty sidebar switches the page to a single full-width column.
<?php $isWide = !empty($item['gallery']); ?>
<?= page_layout([
'main' => $mainHtml,
'sidebar' => $isWide ? '' : $sidebarHtml,
'class' => $isWide ? 'ry-detail-wide' : '',
]) ?>
4. What it does / when to use it
Use this tag for the body of any page that pairs main content with a sidebar: list pages, detail pages, and single-page templates all wrap their body in it. It sets one consistent content width for the whole site, decides whether the sidebar sits before or after the main column, and collapses to a single full-width column when no sidebar is passed. It is not the right tool for a homepage built from freely stacked sections, or for a search page that needs its own narrow container: forcing the skeleton onto those pages buys an extra band of vertical padding and an unused 320px column.
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 this tag for the body of any page that pairs main content with a sidebar: list pages, detail pages, and single-page |
| 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 this tag for the body of any page that pairs main content with a sidebar: list pages, detail pages, and single-page |
| 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 this tag for the body of any page that pairs main content with a sidebar: list pages, detail pages, and single-page |
| 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 this tag for the body of any page that pairs main content with a sidebar: list pages, detail pages, and single-page |
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)
- Build the main column HTML first, a list or an article body with all escaping already applied, and then decide whether this page needs a sidebar. Both values are plain strings, and the tag fetches no data of its own.
- Start with the main column only,
<?= page_layout(['main' => $mainHtml]) ?>, and confirm it renders correctly. At that point it is already a single full-width column.
- Pass the sidebar HTML as sidebar when you need it. The fragment must carry its own
<aside class="ry-sidebar"> wrapper, which is exactly what the bundled sidebar component outputs; the tag only places it beside the main column and never adds that wrapper for you.
- For pages that are sometimes wide and sometimes two-column, pass an empty string as sidebar behind a condition. One template then serves both layouts, so there is no second copy to keep in sync.
- Use class for page-specific styling of your own, such as a different background or tighter spacing. Add your own class there instead of writing another
<div class="ry-wrap ry-layout">.
<?= page_layout(['main' => $mainHtml]) ?>, and confirm it renders correctly. At that point it is already a single full-width column.<aside class="ry-sidebar"> wrapper, which is exactly what the bundled sidebar component outputs; the tag only places it beside the main column and never adds that wrapper for you.<div class="ry-wrap ry-layout">.7. Common pitfalls
- A sidebar fragment without the
ry-sidebar wrapper drops straight into the 320px grid column with no card background and no padding, which reads as broken styling.
- A sidebar value that is non-empty but renders nothing still occupies its column and squeezes the main column. Trim the value first and pass
'' when it is empty.
- Wrapping the call in a second
<div class="ry-wrap ry-layout"> produces a double content width and a double grid, so the main column is indented once and the outer margins are doubled.
- The main column is injected as raw HTML with no second round of escaping. When it contains user input, escape that input before concatenating it into main.
- Fixed-width elements such as large images or wide tables inside the sidebar break out of the 320px column and cause horizontal scrolling. Size sidebar content fluidly.
Note from the reference table List page and detail page templates both rely on it for one consistent content width; do not write your own grid inside a template. The options array also reads: side (right/left/none), wrap, id, main_class, sidebar_wrap and sidebar_class (core/Blocks.php:104-143).
ry-sidebar wrapper drops straight into the 320px grid column with no card background and no padding, which reads as broken styling.'' when it is empty.<div class="ry-wrap ry-layout"> produces a double content width and a double grid, so the main column is indented once and the outer margins are doubled.side (right/left/none), wrap, id, main_class, sidebar_wrap and sidebar_class (core/Blocks.php:104-143).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
Page templates 4 files / 4 calls
-
templates/_shared/detail.php×1 lines 98 -
templates/_shared/feedback.php×1 lines 58 -
templates/_shared/list.php×1 lines 155 -
templates/_shared/page.php×1 lines 38
Template packs 1 files / 1 calls
-
templates/official/detail_pkg.php×1 lines 47
Click "See this code + preview": the left shows the real code around that call site (±12 lines, call line highlighted) and the right renders a real page preview with the current parameters.
Common combinations (generated from your real templates)
- The page template hosting this tag is detail
templates/_shared/detail.php
templates/_shared/detail.php