From GruppoZenit
Jump to: navigation, search

In Z-CMS it is possible to create relationships between Content Models. This is possible using the Attribute type "lookup".

For example below is reported how to relate a Content Model "employee" to a Content Model "status". "Employee" Content Model has a lookup attribute that is related to "status" Content Model as shown in the pictures below.

Bridges 1.png

Bridges 2.png

While content managing inside "employee" Content Model, there is be possibility to choose the "status" of the employee using a combo box which shows the list of the status values saved in "status" Content Model. See below pictures for status records that are then shown using a combo box inside the "employee" Content Manager page.

Bridges 3.png

Bridges 4.png

In this way it is possible to create a one-to-many relationships between Content Models inside Z-CMS.

It is also possible to create many-to-one relationships. For example suppose a product is available in different colours. In that case some "colour" Content Models and a "product" Content Model. Using one-to-many relation it is not possible to have a solution to product related to many colours. A possible solution is to create Content Models for "colours", a Content Model for "product" and another Content Model to keep the relationships (bridge) between many colours and a product. See below the example Content Models:

Bridges 5.png

Bridges 6.png

Bridges 7.png

The content management for these three Content Models is to be done separately in Content Manager part. Then content management for the bridge table (many-to-one relations) is quite difficult for the user since ti implies going into many different pages.

The feature "bridge" in Z-CMS solves this kind of difficulty. To achieve this, once the Content Models are defined, including the bridge, it is possible to add an Attribute of type "bridge" in the Content Model where the many-to-one relation comes (in the previous example, "product" Content Model), as is shown below:

Bridges 8.png

Doing so, instead of separately managing the contents for bridge (many-to-one) relation the user will get the possibility to manage everything inside the Content Model where the bridge type attribute is added by selecting the bridge relation table. Below it is shown the list of colour records and the Content Manager page of "product" which has bridge relation with "colour" Content Model in many (colours)-to-one (product) pattern:

Bridges 9.png

Bridges 10.png

In the bridge relation it is mandatory to select a referenced content Attribute which is having distinct entries throughout the table. Because only distinct items based on the value of referenced content Attributes will be displayed and there will be missing entries if there are repetitions. In such cases just add a file having distinct values and select it as referenced Attributes for lookup.

Example: creating a bridge inside a Content Model

There is a Content Model that has these Attributes:

  • cod
  • group
  • description.

The records are:

cod group description
1 1 test
2 2 test
3 1 test2
4 2 test2
5 1 test3

If a bridge is made to this table and description is selected as referenced Attribute, only checkboxes for "test", "test2" and "test3" will be seen, missing one "test" and "test2". So it will be correct to add a new Attribute to avoid this problem.

Add the new "description_intenal_use" Attribute to above mentioned Content Model:

  • cod
  • group
  • description
  • description_intenal_use
cod group description description_intenal_use
1 1 test test 1
2 2 test test 2
3 1 test2 test2 1
4 2 test2 test2 2
5 1 test3 test3 1

Then make "description_intenal_use" as referenced Attribute for the bridge.

See also

Personal tools