Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,219 of 9,219 pages
About the help in other languages
All help pages

Layout editions: newsletters composed of blocks

Since 5.2.0 an edition can be composed of layout blocks instead of being drawn by the skin's fixed template: a large picture above two columns of articles, a button, a quote, a divider. The block editor is the layout…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/ext/cjw_newsletter/layout-editions.md

On this page

Layout editions: newsletters composed of blocks

Since 5.2.0 an edition can be composed of layout blocks instead of being drawn by the skin's fixed template: a large picture above two columns of articles, a button, a quote, a divider. The block editor is the layout editor of Exponential Layouts (explayouts, explayouts_ui_api); the edition gets a mail layout of its own. The list's skin still draws the frame of the mail (header, footer, unsubscribe and settings links), and the blocks are put inside it.

A mail program is not a browser. There is no JavaScript, <style> is ignored or cut by several programs, layout works with tables only, Outlook for Windows renders with an old engine, images need a fixed width, and Gmail cuts a mail above about 102 KB. So every block that is offered for mail has a mail rendering of its own: mail-safe HTML (tables, inline styles, images with width and alternative text, absolute links; no script, no form, no embedded media) and a text for the plain text part. Web block templates are never used for a mail.

An edition without a layout is a classic edition and is rendered exactly as before.

Requirements

  • explayouts and explayouts_ui_api with mail layouts (the layout group mail, expLayoutsLayoutType::GROUP_MAIL). Without them, or with an older explayouts, nothing of this page is offered and every edition is classic.
  • The database table cjwnl_edition_layout (update 5.1.0 to 5.2.0, upgrade-5.2.md).
  • To edit a layout an editor needs, besides newsletter/editorial and the right to edit the edition, what the layout editor asks for (explayouts_ui_api policies), as for any layout.

For editors

Compose with blocks

The window of an edition (standard and admin4 designs) shows Layout: Rendered by the skin and the button Compose with blocks. It makes a mail layout for the edition (type [LayoutEditionSettings] LayoutType, by default mail_1_column; identifier cjwnl_edition_<object id>, named after the edition) and opens the layout editor on it. The editor lists only mail layout types and the blocks that have a mail rendering; Cancel, Publish and Discard return to the edition. An edition has at most one layout: choosing the button again opens the same one.

The edition then shows Composed of blocks with the state of its layout (published, unpublished changes, never published) and Edit layout, Mail check and, until the edition is sent, Detach layout.

What is sent

A send renders the published state of the layout. A layout that was never published cannot be sent (the send form says so); unpublished changes are not sent, and the send form says that the published state is sent. The output of a send is stored when the send is made, as for a classic edition: changing the layout afterwards changes neither the mails still being sent nor the archive.

Preview and test mail

The preview of the edition and the test mail show the mail rendering. The preview of a layout edition has three tabs: Mail (the HTML part: the blocks inside the skin's frame, under the subject), Text (the text part) and Check (the mail check below, with the size of the HTML part). The skin can be chosen as for a classic edition.

The mail check

Mail check renders the mail (in the list's skin and main language) and lists what will not work in every mail program, each warning with its block:

  • an image without alternative text;
  • an image given by its address: its size is not known, so the mail shows it at the width of its place and the mail program scales it;
  • a block without a mail rendering (an administrator removed it from the settings): it is left out of the mail;
  • free HTML (blocks "HTML snippet" and "Rich text") from which scripts, frames, forms, embedded media, event attributes or javascript: links were removed, or that has <style> elements or classes;
  • a mail whose HTML part is larger than [LayoutEditionSettings] ClippingLimit (102400 bytes);
  • block text on a list with several languages (see Languages).

The warnings also appear in the send form. They never stop a send. The check is static: it reads the HTML, it does not open the mail in mail programs. Testing in real programs (for example with Litmus or Email on Acid) is a manual step.

Detach layout

Until the first send of an edition, Detach layout makes it a classic edition again. The layout is kept as an unused mail layout (an administrator removes it in the layout list). After a send the edition keeps its layout.

Languages

Layout blocks have no language. Content shown by a block (the edition's articles, a single content item, the items of a list) follows the language of each output with the list's fallback, as in a classic edition. Text written into a block (title, text, rich text, HTML, button, quote, card) is the same in every language of the list; the mail check says so for a list with several languages.

Copies of a template edition

A recurring send or the "new articles" condition copies a template edition. When the template is composed of blocks, the copy gets a copy of the template's published layout, published under its own identifier: changing one never changes the other. A newer draft of the template is not copied.

The blocks offered for mail

BlockMail renderingText part
Titleheading of the chosen level, linked when setthe title, underlined
Textparagraphs, line breaks keptthe text
Rich text, HTML snippetthe HTML after the mail filter, paragraphs, headings, lists and links styled inlinethe HTML as text, links with their address
Imagethe image at the width of its place (address images), alternative text, link[alternative text] and the link
Button / Linka button made of a table cell (works without images and in Outlook), or a linklabel: address
Spaceran empty row of its height (0-200 px)one empty line
Dividera line (solid, dashed, dotted)a line of dashes
Cardimage, title, text and link in a frametitle, text, label: address
Quotethe quote with a line in the accent colour, author and sourcethe quote in quotation marks
List (view types list, grid)the linked titles of its items, one under the other or two in a row- title: address
Single contentname, intro and link of the itemname, intro, Read more: address
Two columns, Columna table with two cells of fixed width (50:50, 33:66, 66:33)left column, then right column
Edition articles (newsletter_articles)the edition's articles in its order (pool picks included), list or cardstitle and intro of each
Articles for your interests (newsletter_interests)filled per subscriber at send timefilled per subscriber
Conditional blocks (newsletter_condition)its blocks only for subscribers who match its conditionthe same

Not offered, because they need a browser: carousel, slider, tabs, accordion, map, video, galleries with effects. A video or a map can be shown as an image with a link.

The newsletter blocks

  • newsletter_articles shows the cjw_newsletter_article children of the edition in their priority order, as the bundled skins do. Articles taken from an article pool are such children, so the block shows them as well. Parameters: limit (0 = all), show_intro; view types list and cards.
  • newsletter_interests writes the marker of the "articles for your interests" block (heading, limit), which is filled per subscriber at send time, exactly as {cjwnl_interests_block()} in a skin.
  • newsletter_condition is a container. Its condition has the settings of the "newsletter condition" rich text tag (subscriber field and comparison, lists, languages, interests, the opposite); its blocks are written between condition markers in the HTML and the text part and resolved per subscriber at send time. Conditions can be nested.

These three blocks have Group=mail: the layout editor never offers them for a page.

Columns on small screens

The cells of a two-column block carry the class cjwnl-col. The frame of each bundled skin has a media query that stacks them below the content width; a mail program without media queries keeps them side by side, which still works. This media query is the only <style> of a layout edition's mail.

Skin settings

The mail templates of the blocks write their styles inline from the skin's settings in cjw_newsletter.ini ([Skin_<name>]); an invalid value gives the default:

KeyDefault
ContentWidth600pixels, 320-900: the width of the mail; images and columns follow it
FontFamilyArial, Helvetica, sans-seriffont names, commas and single quotes only
TextColor#222222
LinkColorthe accent colour
BackgroundColor#ffffffthe content area
AccentColor#1f5f8bbuttons, lines, quotes
DarkModedisabledenabled: the frame declares light and dark colour schemes; otherwise light only

Mail programs with a dark mode may recolour a mail on their own; images with transparent backgrounds can look wrong there.

Your own skin and your own blocks

A skin can frame a layout edition when it has outputformat/layout_html.tpl and outputformat/layout_text.tpl (rendering.md). Only such skins are offered in the send form of a layout edition, and a send that names another skin is refused.

Another extension adds a block to mail layouts in its own settings/explayouts.ini.append.php, without reset lines:

[MailBlockSettings]
AvailableBlocks[]=myblock

[MailBlock_myblock]
HtmlTemplate=design:myextension/mail/block/myblock.tpl
TextTemplate=design:myextension/mail/block_text/myblock.tpl
# optional: the view types offered in mail layouts (default: all of the block's)
ViewTypes[]=default

A block that exists only for mail also gets Group=mail in its [BlockDefinition_myblock]. A block without both templates is not offered; in an existing layout it is left out of the mail and named by the mail check.

The templates get block (the prepared block with values, parameters, view_type, plus mail_width: the pixels its content may use, mail_nested: inside a container, mail_columns for two columns), skin (the skin settings above), children (the rendered blocks of a container: html, text, placeholders.<name>.html|text), newsletter_language, and for free HTML mail_html and mail_text (the filtered HTML and its text). Write styles inline, give every image width and alt, use |cjwnl_abs_url for links, and keep [[...]] placeholders as they are; in the text template write every line break as {"\n"}.

Settings

# cjw_newsletter.ini
[LayoutEditionSettings]
LayoutType=mail_1_column
ClippingLimit=102400

The mail layout types mail_1_column (zone main) and mail_header_main_footer (zones header, main, footer) and the blocks offered for mail are in settings/explayouts.ini.append.php of the package.

Limits

  • The check is static and cannot tell how every mail program shows the mail.
  • Block text has one language; layouts per language are not part of this release.
  • Content images inside the core blocks are given by address; their size is not known and the mail program scales them.

Something wrong on this page? Report an error

Documentation license

This page is part of the documentation of the extension cjw_newsletter and is distributed under the license of that extension.