dcm.AnnouncementBand
The
<dcm.AnnouncementBand>
tag represents a container for announcement content in the main page layout. Announcements can be managed through the CMS menu and scheduled for specific dates and times - things like when a store may be closed or any special concerns like covid. When one or more announcements are current then this band appears and the template is used to show each current announcement. When no announcements are current the entire band hides from the users.
Like the
<dc.Band>
this is also a horizontal section of the page from the left most side of the window to the right most. It can be used for providing stripes of background color.
Attributes
-
Pad: how much padding to use inside the container. Values are: None, Small, Medium, Large, Extra - or custom padding defined by your template.
-
Width: How wide is the container. Values are: Full (aka None), Wide, Medium, Narrow - or custom widths defined by your template.
-
Topic: Which topic to show in this “feed”. In the CMS each announcement can be given one or more topics, thus potentially supporting multiple announcement feeds throughout the website. One topic may be shown for any given feed. Required field.
Usage Notes
Announcements have six standard fields available to them, two of which are localized (if the site supports more than one language). These fields are:
- Tile (localized)
- Description (localized)
- Topic: one or more comma delimited words indicating which announcement feed(s) this announcement is for. Example: home,other
- Note: this is an internal note for the staff scheduling the announcement
- StartAt: the date and time when this announcement should begin showing
- EndAt: the date and time when this announcement should end showing
Time is based on the website's timezone, not the users. The EndAt and StartAt fields accept values of plain dates or dates and times. Dates must be entered year first as such YYYY-MM-DD. If time is used then it must be entered HH:MM am|pm. Examples:
2022-01-20 11:00 am
2022-2-12 4:40 pm
2022-04-04
If no time is given, it is treated as 12:00 am - midnight the start of the day. In the template the above fields can be accessed using:
$Entry.Fields. fieldname
Typically only the Title or Description field would be of interest when building the template. These fields will both be already localized when accessing the field. So
$Entry.Fields.Title
would provide the Spanish, English, etc version of the announcement, if one was available.
Examples
Very Simple Template
This example lists the Title only of each current Announcement with a topic of
home
.
<dcm.AnnouncementBand id="announcementsBand3" Topic="home" Width="Medium" Pad="Medium">
<Template>
<div class="announcement-entry">{$Entry.Fields.Title}</div>
</Template>
</dcm.AnnouncementBand>
Example html generated from this would be:
<div id="announcementsBand3" class="dc-band">
<div id="announcementsBand3Body" class="dc-band-wrapper dc-band-width-medium dc-band-pad-medium">
<div class="announcement-entry">Closed for X-mas</div>
</div>
</div>
Template with Markdown
This example lists the Title and Description of each current Announcement with a topic of
sales
. Markdown is used to provide basic formatting to the announcement.
<dcm.AnnouncementBand id="announcementsBand1" Topic="sales" Width="Medium" Pad="Medium">
<Template>
<dc.TextWidget class="announcement-entry">
<Tr><![CDATA[
### {$_Entry.Fields.Title}
{$Entry.Fields.Description}
]]></Tr>
</dc.TextWidget>
<hr />
</Template>
</dcm.AnnouncementBand>
Example html generated from this would be:
<div id="announcementsBand1" class="dc-band">
<div id="announcementsBand1Body" class="dc-band-wrapper dc-band-width-medium dc-band-pad-medium">
<div class="announcement-entry dc-widget dc-widget-text">
<h3>
<span>Closed for X-mas</span>
</h3>
<p>happy holidays and <strong>peace</strong> on earth</p>
</div>
<hr>
</div>
</div>
See Also
-
This has many characteristics of a
dc.Band
-
Template however, works like
dcm.FeedWidget
- Video demo of Announcements feature in CMS