Download the PHP package plato-creative/sections without Composer
On this page you can find all versions of the php package plato-creative/sections. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download plato-creative/sections
More information about plato-creative/sections
Files in plato-creative/sections
Package sections
Short Description Sections
License BSD-3-Clause
Homepage http://github.com/plato-creative/sections
Informations about the package sections
Sections
Installation
Composer is the recommended way of installing SilverStripe modules.
Requirements
- silverstripe/cms ^4.0
Maintainers
- Plato Creative
Documentation
Add sections to a page
Standard section area
Add a sections area to a page type.
By default this will add a sections area that can be accessed via page templates with {$Area}
Multiple section areas
To add multiple sections to a page type.
This can be accessed in the page template with:
Limit section types by page type
Set allowed sections.
Set excluded sections.
Create new section types
Add a custom form to a section controller
Templating
File names
Sections will look for the template based on the section section name in you theme template directory. e.g. MyCustomSection will look for MyCustomSection.ss.
In addition sections will look for templates that have a specific layout appended to it. e.g. MyCustomSection_left-text.ss
Sections will also look for templates that are specific to a page type. e.g. MyCustomSection_homepage.ss
Finally sections will look for templates that match both specific layout and page type. e.g. MyCustomSection_homepage_left-text.ss
Filename hierarchy example
Taking the following conditions page classname = HomePage, section classname = MyCustomSection, section layout = left-text and extends MyParentSection we can see the templates that are searched and their priority from first to last.
Sections template variables
Sections has a few useful variables to help.
{$Class}
: Returns the class defined by the section object or layout it may have.
{$ClassAttr}
: Returns a class attribute with the class of the section.
{$Color}
: Returns color defined by the section object.
{$Anchor}
: Returns a html safe string based on the title of the current section.
{$AnchorAttr}
or {$TargetAttr}
: Returns a id attribute based on the title of the current section.
{$Pos}
The current integer position in the area. Will start at 1.
{$Even}
, {$Odd}
, {$First}
, {$Last}
or {$Middle}
: Booleans about the position in the area.
{$CurrentPage}
: Access the current page scope.
Section template title
By default $Title
in sections uses HTMLTag to wrap a tag with html defined in the cms.
So your template can simplified to this.
Is the equivalent of
And returns