Hi there!
I’m trying to sort the event of the “grandchildren” of a page alphabetically by their names.
This code isn’t working for me. It only shows the list sorted by their creation dates.
Note: There is only one event for every $day
(Please ask me if you don’t understand what I mean)
<table class="number-list">
<?php $day = $pages->filterBy('template', 'calendar')->children()->children(); foreach($day as $video): ?>
<?php foreach ($video->events()->toStructure()->toStructure()->sortBy('name', 'asc') as $event): ?>
<tr>
<td class="text-center"><p>
<a class="fancybox-frame" href="http://www.youtube.com/embed/<?php echo $event->youtubeid()->html()?>?list=PL0nBAqtSzTDp4r9kz7PqauS1SSww9O68-&enablejsapi=1&wmode=opaque&autoplay=1"><?php echo $event->name()->upper() ?></a>
</p></td>
</tr>
<?php endforeach ?>
<?php endforeach ?>
</table>
my blueprints:
title: day
pages: false
icon: youtube-play
deletable: true
fields:
title:
label: Day
type: text
readonly: true
events:
label: Video
type: structure
fields:
name:
label: Name
type: text
youtubeid:
label: Link
type: text