Hey,
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!
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' />
</cms:repeatable>
<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">
</video>
<script>
var videoSource = new Array();
<cms:show_repeatable 'content_video' >
videoSource[<cms:show order />]='<cms:show video />';
</cms:show_repeatable>
var videoCount = videoSource.length;
var i=1;
$("#myVideo").attr("src",videoSource[0]);
$('#myVideo').on('ended', function(e) {
if(i == (videoCount)){
i = 0;
}
videoPlay(i);
});
function videoPlay(videoNum)
{
i++;
$("#myVideo").attr("src",videoSource[videoNum]);
}
</script>
<?php COUCH::invoke(); ?>