on
DD4T2 - Resource Management (.NET)
I recently had to implement a feature on SDL Web 8.5 for managing resources and found out that DD4T 2 already have this available out of the box. It’s called Dynamic Resource Management.
Unfortunately, there’s limited documentation so I thought I’d write about my experience in order to remind myself in the future and help those who may need it too.
Setup
Create a page template in Template Builder. Add DD4T’s Resources TBB and ensure that the file extension of the page is set to ‘xml’.
Create a component template using Template Builder which has a default Cleanup TBB. Ensure the template is linked to the Labels schema.
Create the component with a sample label using the same schema as the screenshot above and add to a page using the page template and publish.
Web App
In your web app, add an app setting:
The value is the filename published to the broker database.
Create an extension method:
You can then use these in your views:
This post is heavily influenced by Rob’s post here.