How to display contents of addon in a template file?


#1

Hi,

I want to use this addon: GitHub - TheBnl/silverstripe-openinghours: Add opening hours to a DataObject. I added the addon into the admin settings page by adding this to my yaml file:

SilverStripe\SiteConfig\SiteConfig:
extensions:

  • ‘Broarm\OpeningHours\OpeningHours’

How to show the opening hours in a template file like page.ss?


#2

In your template, use the names of the methods listed at the bottom of the module’s home page. If the name starts with “get”, leave that off. Examples:

$IsClosed
$IsOpenNow
$OpeningHoursToday

For more information about templates: https://docs.silverstripe.org/en/4/developer_guides/templates/


#3

Thanks, got it working!