Dimensions
In webCOMAND, dimensions provide a way to identify, manage and query different Variants, which are variations of the same content item, meant to be used in different contexts. For example, a Language dimension can be used to identify, manage and query different language translations of content. A content item with a Language dimension might have three variants: English, French and Spanish. If the content has a title field, each variant would define the appropriately translated title.
Dimensions can be used to implement:
- Localization - Translations of the same content into multiple languages.
- Segmentation - Create personalized versions of content to be presented to different user segments.
- A/B Testing - Create different versions of content to be presented to different test groups of users to compare engagement and outcomes.
- Formats - Store multiple versions of content for fast retrieval based on the desired format. For example, certain sizes, cropings and image formats of image data. Images can also be processed on the fly, but this is useful for storing manual or pre-processed versions as well.
- Personalization - One or more dimensions can be used to manage and present content that caters to specific consumer demographics.
How Dimensions Work
webCOMAND comes with a Dimension Content Type, which has a few fields used to identify and query content variants for a specific dimension. These include:
- Identifier - The Key used to identify a content variant in queries.
- Title - Optional name used to identify a content variant in the user interface.
- Description - Optional description of the content variant, displayed in the user interface.
- Icon - Optional image to represent the content variant in the user interface.
User Interface
Once a dimension is added to a content type, the Variants Sidebar is available in Form View.
Queries
cPath and cQL queries can retrieve content of the desired variant using the WITH Clause.
SELECT Title FROM WebPage WITH EN
PHP API
The PHP API provides methods to access an manipulate object variants.
$repo = comand::repo();
$langs = $repo->get("FROM Language");
$page = $repo->get("FROM WebPage WHERE OID=123");
foreach($langs as $lang) {
$variant = $page->get_dimension($lang);
echo($page->Title . " (" . $lang->Title . ") does" . ($variant ? "" : " not") . " exist.\n");
}
Add a Dimension
Add a new dimension with the following steps.
- Ensure dimensions are enabled for the repository. See Dimensions Configuration.
- Define a content type that extends the Dimension Content Type. For example, a Language content type that extends Dimension.
- Add content of the new Content Type to specify the Identifier and optional Title, Description and Icon for each variant.
- Enable variants using the new dimension by adding a new relationship field for the new dimension to each desired content type.
Localization
The most common use of dimensions is content localization. The io_comand_localization package makes it easy to add localization with the following steps.
- Import the io_comand_language package.
- Update each content type that contains content you would like to localize (or a common content type they extend).
- Update any existing queries to request the desired language.
- Update any existing publication content types you wish to localize.