Call 1-888-670-1652

 Spire CoreDB Connect Error (2002) Connection timed out

How to Implement Randomized Content

In order to implement randomized content on your pages, so that different material (such as images, videos, or text) are displayed each time that the pages are viewed, there are two system tags that you can use.

First is the <sys:shuffle> tag.

In order to make use of this tag, simply access the desired page, and, within the "Source" editor, enter the tag in the location on the page where you would like the randomized content to appear. Make sure to enter a closing tag as well: </sys:shuffle>.

Then, in between the opening and closing tags, enter the file paths of the content (such as images or videos) that you would like to be displayed randomly.

Once you have specified the desired content, you need to make clear how many of the options you would like to be displayed at a time. In order to do so, insert 'max="x"' into the starting tag, replacing x with the number of images or videos that you would like to be displayed at once, so that the tag looks something like this: <sys:shuffle max="1">. Otherwise, should you not specify a maximum number, all of the listed content will be displayed at once in some random order.

In the end, the code should look something like this:

<sys:shuffle max="1">

<img src="img1.png"/>

<img src="img2.png"/>

<img src="img3.png"/>

<img src="img4.png"/>

</sys:shuffle>

The other option in implementing randomized content can only be used with files stored in the "/styles" folder.

In order to determine the files that will be displayed, simply access the desired page, and, within the "Source" editor, enter a tag specifying the file path of the folder containing the files in the location on the page where you would like the content to be displayed.

In order for the files within the specified folder to be displayed randomly, you must also tag "/random"/" onto the end of the file path. This piece of text tells the system to replace "random" with the name of one of the files in the specified folder, so that a random one will appear on the page each time that it is viewed.

In the end, the tag should look something like this: <img src="/styles/decorations/random"/>. In this example, each time that the page in question is viewed, a random image from the "decorations" folder will be displayed in the location at which the tag was entered.