Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1

Is it possible to output/show the order value for each row in a repeatable region?

I'm using the repeatable regions within a bit of javascript to play videos in a browser in a loop, the below works perfectly but would love to change the order through the CMS' drag and drop ordering. It might be a big ask, but thought I'd check with the experts!

Many thanks!

Code: Select all
<?php require_once( 'admin/cms.php' ); ?>
<cms:template title='Airtame' />
<cms:repeatable name='content_video' label='Video Playlist'>
<cms:editable type='file' name='video' label='Video' input_width='850' />
<cms:editable type='text' name='order' label='Order' col_width='100' input_width='20' />
<meta http-equiv="refresh" content="3600" />
<link rel="stylesheet" href="css/main.css" />
<script src="js/jquery.min.js"></script>

<video autoplay muted id="myVideo">
  <source src="" type="video/mp4">
    var videoSource = new Array();

<cms:show_repeatable 'content_video' >
videoSource[<cms:show order />]='<cms:show video />';

var videoCount = videoSource.length;
var i=1;

  $('#myVideo').on('ended', function(e) {

    if(i == (videoCount)){
      i = 0;

function videoPlay(videoNum)

<?php COUCH::invoke(); ?>
Simply replace "order" with k_count and add startcount -
Code: Select all
<cms:show_repeatable 'content_video' startcount='0' >
    videoSource[<cms:show k_count />]='<cms:show video />';

Videos will be indexed correctly, starting from top to bottom, 0 to ..

Startcount is needed because later in the script there is an explicit value 0

Even a field 'order' is redundant now.. :)

My Documentation, Addons, Functions.
Join COUCH:TALK telegram channel
That was exactly what I need, thank you so much!
You are welcome, @bbiddiscombe.

Complete reference of tag show_repeatable with all 10 parameters and examples is published for the first time at Midware Tags Reference » show_repeatable

My Documentation, Addons, Functions.
Join COUCH:TALK telegram channel
4 posts Page 1 of 1