#epi7fin #episerver7 1 EPiServer 7: Content Blocks Petri Isola Lead Technical Sales Engineer #epi7fin #episerver7 2 What Are Blocks? • Reusable smaller content parts • Defines a set of properties • Inherits from BlockData • Can be shared or local • Rendered via user control (.ascx) or web control When to Use Blocks • Simplify for Editor and Developer by reusing functions – Across template boundaries (shared block) – Example: Latest news, Upcoming events – Display the same information in many places, only edit it in one – Example: Advert, Contact details – Re-use existing set of properties in a specific template (local block) – Example: To add a Job listing on one particular page, the listing block is re-used locally as a ”property”. Multi-Site • One site library for each site! • One global library for all sites! • A block can be “Site local” “Site global” • Different css/javascripts on each site makes the same block look different! Block, Block Type and Block Template • “It’s all Content” Block Block Type Properties Block Template Block Types vs. Page Types • With page types you can put restrictions via admin on where they can be used • Block types can be used on any page type that has a content area (depending on tags) • Security access can be put on page types, you can hide specific page types from editors • You cannot hide block types from editors, all will be showed for everybody (read access is not enforced in edit mode) Shared Block • Stand-alone entity • Stored, versioned and loaded individually in the database • Referenced from several pages or blocks Block Shared block Page Block Type Properties Block Template Folders • Instance of ContentFolder • Used to structure content – structures shared blocks • Not displayed in the page tree or to the visitor • Localization and access • Cannot be versioned A Block Can Be Used as a Property on a Page • This is what we call a “local block” • For code reuse – Used at another page – Used as a shared block ”Local” Block • Used as a property on a page type • Part of a page instance • Stored, versioned and loaded with the page Block Block Type Block Template Local block Shared block Properties Page Page Type Dynamic Content vs. Blocks Dynamic Content Dynamic Content Is Local Access Rights Almost the Same More Powerful… • Store modularized data into a structure called, “BlockData” instead of hiding it behind PageData • Eases migrating websites onto EPiServer as modular data is more easily defined through blocks and strongly typed code definitions • The pre-defined properties for BlockTypes are accessible to the user control using “CurrentBlock” • And data stored for a block is not specific to a page but the block itself! • We can also search and organize these blocks using a user-definable folder structure that makes organizing blocks simple Questions? Petri Isola petri.isola@episerver.com