Jump to content

Fetching randomly from repeater but output from same repeater entry


Recommended Posts

Posted

Hi there,

Am really stuck on this one and I had a look around but couldn't work this out still.

I have a repeater field (screenshot attached) - and I want to run a command such as:

<?php echo  $page->homepage_media->getRandom()->video_strip_1->url  ?>
<?php echo  $page->homepage_media->getRandom()->video_strip_2->url  ?>
<?php echo  $page->homepage_media->getRandom()->video_strip_3->url  ?>
<?php echo  $page->homepage_media->getRandom()->video_strip_4->url  ?>
<?php echo  $page->homepage_media->getRandom()->video_strip_5->url  ?>

 

So I want all random links output individually but all from the same repeater entry.

Does that make sense?

Sorry would appreciate any help.

Screen Shot 2017-02-10 at 16.06.09.png

Posted
<?php
$entry = $page->homepage_media->getRandom();

echo $entry->video_strip_1->url;
echo $entry->video_strip_2->url;
echo $entry->video_strip_3->url;
echo $entry->video_strip_4->url;
echo $entry->video_strip_5->url;

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...