Itemspace

From The Smartest Wiki
Jump to: navigation, search

An itemspace is a mechanism of Smartest by which an item can:

  • be displayed or manifested on a standard Smartest web page, and
  • be replaced with another item of the same model at any time with user input alone.

Itemspaces are one of Smartest's five standard content management elements, and is triggered in a template using the <?sm:itemspace:?>

For example, imagine on the front page of a hypothetical blog, there was a space for a single "featured blog post." In Smartest, this could be given effect with an Itemspace.

An itemspace thus always gives the user an option to choose an item. However, an item space may also display a template, specifically for the purpose of displaying the item that has been chosen.

Creating a new itemspace

Itemspaces are rendered with the template tag <?sm:itemspace:?>. For example, in the case of the "featured blog post" mentioned above, it might look something like:

<?sm:itemspace name="featured_blog_post":?>

Note that just with placeholders, containers, and lists, the name of the element in the template is always given in lowercase, using underscores instead of spaces.

This tag will be recognised, and displayed in the page elements tree as follows:

New itemspace.png

To add the itemspace to the system, simply click the "enter it now" button.

You will then see a dialogue asking you how the itemspace should be created:

Create itemspace.png

The most important choices on this screen are:

  • Choose the data set from which items for this data set will be selected in future, and
  • Choose the template (if any) with which they will be displayed. Smartest can create a new template for you if none exist but you would like to use one.

Then save your new itemspace and the page elements tree will now show it as recognized:

Existing itemspace.png

Define the itemspace

If you select an itemspace in the page elements tree and choose "Define this itemspace" in the actions area, you will be presented with a simple dialogue with which to choose the item to be shown:

Define itemspace.png

Simply choose the item from the dropdown menu, and hit the 'save' button, and the itemspace will be updated. Next time the page is published, the itemspace will update on the live page too, but only if the selected item is also published.