Welcome to the OpenCities help centre. Search for what you're after, or browse the categories.
Can't find what you're looking for? Submit a support ticket and we'll be in touch.

Follow

About Device Variables

avatar of OpenCities Product Team

OpenCities Product Team

Last updated

This task is for users with the OC Developer role.

A device variable can be used to store reusable code snippets. These can range from just text snippets to references to fields.

A good example of a device variable is the pagination variable. You can use the following code snippet in your content lists to render the same pagination used by all out-of-the-box content lists:

<DeviceVar var="OC DV Pagination" /> 

We call them "device variables" because you can extend this snippet to exclude or include the selected variable depending on the device. The three devices available within the CMS are desktop, tablet, and mobile.

If you want to include a specific device variable only on a desktop, use the following code snippet:

<DeviceVar var="[Your variable name]" include="Desktop" />

To exclude, use the attribute exclude. You can combine multiple devices using a "|" character, for example include="Tablet|Mobile".

Was this article helpful?
0 out of 2 found this helpful