As with pages, every resource is represented by a CMS object based on an object class that defines the properties and thus the type of the resource.
So, how do we display the information contained in a resource? Right, we simply use widgets. This enables editors to place a resource where they think is appropriate.
Widgets for displaying resources can be connected to a single resource or several resources at once by referencing them using a referencelist
attribute. Additionally, attributes for controlling adjustment, size, etc. could be provided. For example, an “ImageWidget” that includes text might have an option for specifying whether the text should be displayed to the right or to the left of the image.
There is no limit regarding the number of widgets one may provide for displaying resources of a particular type. You could, for example, write a widget that displays the address and opening hours of a “Store” resource, as well as a widget that uses Google Maps to visualize the location of a store or even of several stores. Similarly, you could create a widget that is able to handle multiple resources of different types. For example, think of a “GalleryWidget” that displays a set of images for a given resource type (e.g. store, product). You could easily implement such a widget after adding a “gallery” attribute referencing an image to the resource types.
The possibility to separate resources and the way they are displayed on a page offers several advantages. The most prominent is that resources can be altered using a common tool, the Content Browser, and that changes to them are instantly reflected throughout your website.