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 is a Developer task

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 OpenCities pagination variable. You can use the following code snippet in your content lists to render the same pagination used by all OpenCities 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 OpenCities 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, include="Tablet|Mobile".

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