I am needing to obtain a count for every video being parsed through Channel Videos via relationship entries. I want to continue using a grid with my layout so the content can scale like the rest of the site.
I have a channel of entries which is nothing more than a DevDemon Channel Entries field which contains groups of videos. Each of these groups can be added to other channel entries as modules. So you may have a Lesson Module with 5 groups of videos and each video group could have 1-?? videos in it.
I was using an embed for the relationship loop, but I was loosing count each time and starting over at 0/1, so I started trying to calculate the numbers via raw PHP. I am completely open as a better way of doing this because I am banging my head against the desk. lol
Here was my latest attempt:
<ul class="classes available-classes clearfix">
<?php $count = 0; ?>
{exp:channel:entries
disable="category_fields|member_data|pagination"
category="1"
channel="program_module"
status="open"
show_future_entries="no"
show_expired="no"
}
{video_groups_to_include}
{exp:channel_videos:videos
status="open"
entry_id="{video_groups_to_include:entry_id}"
}
<?php
$count++;
echo $count;
if( $count==1 || $count==5 || $count==9 || $count==13 || $count==17 || $count==21 || $count==25 || $count=29 || $count==33 || $count==37 || $count==41 || $count==45 || $count=49 || $count==53 || $count==57 || $count==61 || $count==65 || $count==69 ){
echo "<li class='row-fluid'><ul><li data-id='id-{video:id}' class='span3 {video_groups_to_include:categories}{category_name}{/video_groups_to_include:categories}'>";
}else{
echo "<li data-id='id-{video:id}' class='span3 {video_groups_to_include:categories}{category_name}{/video_groups_to_include:categories}'>";
}
?>
<a href="{site_url}lessons/{video_groups_to_include:categories}{category_url_title}{/video_groups_to_include:categories}">
<em class="overflow-hidden"><img src="{video:img_url_hd}" alt="{video:title}" /></em>
<span>
<strong>{video:title}</strong>
<i>{video:description}</i>
</span>
</a>
<?php
$count++;
if( $count==4 || $count==8 || $count==12 || $count==16 || $count==20 || $count==24 || $count==28 || $count=32 || $count==36 || $count==40 || $count==44 || $count==48 || $count=52 || $count==56 || $count==60 || $count==64 || $count==68 || $count==72 ){
echo "</li><ul></li>";
}else{
echo "</li>";
}
?>
</li>
{/exp:channel_videos:videos}
{/video_groups_to_include}
{/exp:channel:entries}
</ul>
Hopefully it's clear what I am trying to achieve. Basically, I need a new row after ever 4th video parsed. (4 column layout)