To show the capabilities of Structured Content, this guide has been written in nothing but Structured Content Blocks.
In the block edit dialogue simply enter your content as lines of plain text. Each new line in the text will become a new item, be that a paragraph, a bullet point in a list, or a heading. Just what kind of items a particular structured content block shows is selectable using the pull-down menu at the bottom of the block edit dialogue.
For tables, each line of text becomes a row of the table. The lines are then split into cells by tabs or semi-colons ';'. The first row of a table will be formatted as a heading row where dictated by the selected template.
Each Structured Content block can be used for just one format of the lines in the block. For more complex content, you can simply create several blocks.
An associated dashboard page at Dashboard > Stacks & Blocks > Structured Content provides site-wide options that add a few embellishments, such as auto-linking from URLs and to allow some basic html formatting tags, styles and classes. If you want to change the list of tags allowed within Structured Content, you can define them as a comma separated list in a site wide constant in config/site.php.
The code fragment above has been inserted as a Structured Content block, then further enhanced using Syntax Anywhere to highlight the syntax.
By default, Structured Content includes a style sheet that provides some basic styling for Structured Content blocks. This is as unobtrusive as possible so as to allow most of the styling to be taken from your site theme. If you don't want these styles, you can simply check a box to switch them off in the dashboard page.
The templates provided with Structured Content should cover most uses. The current list of templates is inserted below using the Structured Content 'Unordered List 2 Columns' template.
- Paragraphs (default template)
- Block Quote
- Definition List
- Heading Level 2
- Heading Level 3
- Heading Level 4
- Ordered List
- Ordered List Striped
- Preformatted Code
- Preformatted Wrapped
- Table Full Width
- Table Full Width Heading Border
- Table Full Width Heading Border Zebra Striped
- Table Full Width Heading Zebra Striped
- Table Full Width Zebra Striped
- Table Heading Border Zebra Striped
- Table Heading Zebra Striped
- Table Zebra Striped
- Unordered List
- Unordered List 2 Columns
- Unordered List Striped
Nevertheless, if these are not enough or you need a specific variation, you can easily add more templates using the concrete5 site specific templates folders at:
- site-root/blocks/jl_structured_content/templates/your-template_name/view.php (if you also want to add a view.css file).
Because the length of block template file names is restricted by the concrete5 core, the Structured Content edit dialogue will expand abbreviations in the filename to make them more readable:
- hd : Heading
- head : Heading
- bdr : Border
- full : Full Width
- stripe : Zebra Striped
- strp : Zebra Striped
- cols : Columns
To make it easy to insert images, Structured Content includes templates for the core Image block to float images left or right. To place an image with Structured Content, simply insert an image block immediately before a Structured Content block and assign it one of these templates, like I have done with the image on the right.
If you also have Magic Data or Oembed, you can insert Magic Data tokens or let Oembed expand media links. Simply enable the dashboard settings and all your Structured Content blocks will automatically integrate with these addons and process the associated tokens or links.
For example, the following Totally Random video, featuring reviews of Structured Content and the associate Oembed plugins for UCP and Magic Data, is inserted by simply putting the url inline between oembed tags and letting oembed do the rest!
Finally, I say thank you for reading about Structured Content from JohntheFish. Nothing flashy, just using Magic Data to automatically insert the name of the parent page (PAGE PARENT PAGE_NAME) and the name of the page owner (PAGE OWNER USERNAME), but it does verify that Magic Data is doing its stuff within this Structured Content block.
Last updated: over a year ago