Hand-written Includes in-depth notes
Block section
No call site in this site yet
Standard block skeleton with a title, a subtitle, a View more link, and content; use it when assembling a home page so spacing and heading levels stay consistent.
section($title = '', $subtitle = '', $content = '', 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 46 to see the definition of section(). 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: section
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 10 parameters, one per row; scroll sideways on narrow screens.
click the title to collapse / expand
| Parameter | Type | Default | Description |
|---|---|---|---|
title |
string |
'' | Block title, rendered as an <h2>; an empty string omits the heading. |
subtitle |
string |
'' | Subtitle, rendered as a <p>; an empty string omits it. |
content |
string |
'' | Block content HTML, printed raw after the heading area. |
o |
array |
[] | The whole options array (advanced): merged with the sub-keys below via array_merge(whole array, ['sub-key' => value]), and a sub-key wins on a name clash. Normally use the sub-keys instead. |
class |
string |
required / as needed | Class appended after ry-sec, such as the factory background class ry-sec--soft (core/Blocks.php:55). |
more_url |
string |
required / as needed | URL of the View more link; the link is not rendered at all when it is omitted, which is the hardest kind of gap to trace (core/Blocks.php:62). |
more_text |
string |
t('more') | Label of the View more link; falls back to t('more') from the language pack, not to View all (core/Blocks.php:67). |
center |
bool |
false (not centred) | true switches the heading area to the centred variant (core/Blocks.php:70). |
id |
string |
required / as needed | Anchor id of the block: news renders as <section id="news"> (core/Blocks.php:57). |
tag |
string |
section (default) | Outer tag, section by default; only lowercase letters and digits are accepted and anything else silently falls back to section (core/Blocks.php:56). |
3. Examples Every example can be copied as-is; the later ones are more advanced.
click the title to collapse / expand
Smallest working call
Title and content only, with the factory vertical spacing and a second-level heading for the band title.
<?= section('News', '', $html) ?>
Typical band with subtitle, View more, and a soft background
The URL must go into more_url, and the background comes from the factory class with no extra CSS.
<?= section('News', 'What we have been working on', $html, [
'more_url' => '/news/',
'more_text' => 'View all',
'class' => 'ry-sec--soft',
]) ?>
Advanced: centred heading area with assembled data
Assemble the data into HTML first and pass it in one call; center switches the heading area to the centred variant.
<?php
$cards = '';
foreach ($items as $item) {
$cards .= '<a class="ry-card" href="' . $item['_url'] . '">' . $item['title'] . '</a>';
}
?>
<?= section('Case studies', 'Industries we serve', '<div class="ry-cards">' . $cards . '</div>', [
'center' => true,
'more_url' => '/case/',
'more_text' => 'All cases',
'class' => 'ry-sec--soft',
]) ?>
4. What it does / when to use it
Use it when you assemble a home page or a landing page and need a standard band with a title, a subtitle, a View more link, and content: it unifies the vertical rhythm, the heading level, and the background class so surrounding bands stay consistent. Do not use it for an article body or for a small heading inside a card, because every call adds another band heading and nesting them fills the page with headings on the same level.
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 a home page or a landing page and need a standard band with a title, a subtitle, a View more li |
| 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 a home page or a landing page and need a standard band with a title, a subtitle, a View more li |
| 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 a home page or a landing page and need a standard band with a title, a subtitle, a View more li |
| 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 a home page or a landing page and need a standard band with a title, a subtitle, a View more li |
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 section('News', '', $html), passing the title, the subtitle, and the content separately, where the content is HTML you have already prepared and is printed as-is.
- Add a View more link by passing the URL in more_url, which is the only key that renders it, and the label in more_text, which falls back to the translated More label when omitted.
- Pass class for a soft full-width background using a factory class such as ['class' => 'ry-sec--soft'], and add ['center' => true] when the heading area should be centred.
- Fetch the data first, then assemble it into an HTML string and pass it once: titles and subtitles are escaped, so never put fetched markup into the title or it appears as literal text.
- Order the bands so the headings read as a table of contents: one second-level heading per band, child headings one level below, and never two headings on the same level for the same page.
7. Common pitfalls
- The View more key is more_url, not more. A call such as ['more' => '/news/'] is never read by the implementation, so the link is not rendered at all and the page simply looks like it lost its View more link, which is the hardest kind of gap to trace.
- The bg key is not read either. Change the background with class and a factory background class, or set it on an outer element instead of expecting a colour key to work.
- Titles, subtitles, and the View more label are escaped, so markup such as strong never takes effect and its text shows literally. Assemble rich markup in your own wrapper when you need it.
- When the title, the subtitle, and more_url are all empty the band still renders but has no heading area. If page structure depends on its second-level heading, pass a title or the section is empty in the document outline.
- The content is not escaped, so escape the strings you concatenate into it, exactly as with the container tag.
- Nesting a titled band inside another titled band produces two headings on the same level and breaks the outline; omit the inner title or demote the inner heading by one level.
Note from the reference table Fix the example and defaults: use more_url instead of more, and more_text defaults to t('more'). When title, subtitle and more_url are all empty, the whole heading area is skipped.
more_url instead of more, and more_text defaults to t('more'). When title, subtitle and more_url are all empty, the whole heading area is skipped.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.