#2 Working with Block Contents
Working with Block Contents
In most cases a template will run in a context - so something prepared data for the template, which should now be visualized. These examples assume you're working with 2sxc, which let's editors work with content - and your template only needs to visualize it. The current content item (if it's just one) is always available on the variable called Content
. It's a dynamic
object, so you can just type things like @Content.FirstName
to access the properties.
Show Entity Values from the current Data
Showing values from Data (aka. Entities) is very easy. Normally they are accessed through Item (new Razor) or DynamicEntity (older Razor) objects.
Work with Content Items - MyItem
MyItem is the object which contains the first thing added by the editor on the current block.
Work with List of Items - MyItems
#2 Working with Block Contents