Please help us by completing this survey

Go to survey
Documentation

Docs / Development / Content

Content

A Content is the basic block for storing information in sensenet. A Content can be any kind of data: for example users, documents, memos, tasks, text files, etc. are all referred to as content in the portal. Any content can be created, edited, copied, moved or deleted easily.

Some of the features described in this article (about displaying content on Pages) are available only if you have the sensenet WebPages component installed, but the underlying philosophy of the content structure applies even if you only have the core Services layer.

Where can I find these content?

Content are stored in the Content Repository - the storage layer for the portal. The Content Repository is basically a tree structure of the various stored content of the portal. A specific Content is identified by a unique id and also by its path in the Content Repository - the relative path to the root content. The root of the Content Repository is a content at the /Root path, and all other content is placed somewhere under this root content - for example the login page for the default site is placed at /Root/Sites/Default_Site/login.

How should I imagine a Content?

Every Content is built up of Fields (a user Content for example has a name field and password field). Different types of content can be created by defining a different set of fields. The type of the the Content is called the Content Type and defines the set of fields a Content possesses and also the behavior of the Content. The set of fields the type defines is reusable, meaning different types can be created by deriving from already defined types and the newly created type will obtain the fields of its parent type. For example: a File Content has - among a couple others - a name Field for storing the name of the file and a binary Field for storing the binary data of the file, and an Image Content (whose type is a child type of the File Content Type) also have a name (for the name of the image) and a binary Field (for the image pixel data) and a couple of other fields, too - that a simple File does not contain: Keywords (for making the image searchable), DateTaken (for storing the info of when the picture was taken in case it is a photo), etc.

How does a content look like?

A single Content can be presented in many forms:

You can visually see the content when they are enlisted in a list or in a tree, for example in Content Explorer, the administrative surface of the portal.

Content tree

Also, the individual content can be edited, in this case mostly you will be presented a surface where you can edit the content’s fields.

Content fields

Besides, the content can be presented in any visual form with the aid of Content Views or XSLT Renderers.

Content view

The way a content looks like mainly depends on the scenario it is used in (a folder for example is used to contain other content, so it shows the list of its children, whereas an article represents some kind of textual information and pictures so it shows the visually formatted text and contained images), but the look of any kind of content can be fully customized.

How can I store / browse my data in the portal?

The Content Explorer administrative surface of the portal provides a handful of tools to manage content. You can create new content of the defined Content Types and fill their fields with data, you can define new Content Types of any kind, you can copy, move, delete, rename content and upload / download files into / from the Content Repository. It is also possible to Import large amount of data from the file system into the Content Repository (and also to Export them from the Content Repository into the file system).

Starting with sensenet 7.0, export and import functionality is done using the SnAdmin tools that are available in the core package. You can also create a custom export/import tool using the .Net client library.

Accessing content through the REST API

In case you have only the core Services layer installed, you do not have a UI at all, but you can still access your content in the repository through our REST api.

How can I reference a content?

Content can be referenced most easily via a url built from the site url and the path of the Content. For example you can request the content under /Root/YourContents/FooterContent with the http://example.com/Root/YourContents/FooterContent url. In this case the content will be displayed using its Browse view. To edit the content the action=Edit url parameter can be used: typing http://example.com/Root/YourContents/FooterContent?action=Edit will show the Content in Edit mode and thus the content’s fields can be edited right away. The mechanism that allows Content to be requested via their Content Repository paths and an action parameter is defined by the Smart Application Model. The Smart Application Model makes it possible to create custom actions for the Content. You can check the most common available actions on a content in Content Explorer - they are listed at the top part of the page. To view a content in Content Explorer you can

Examples/Tutorials

The following are some example content in the Content Repository:

Is something missing? See something that needs fixing? Propose a change here.