<?php
$images = $page->images()->sortBy('sort', 'asc');
foreach($images as $img): ?>
print images...
<?php endforeach ?>
Now it print all image in this page.
img-1
img-2
img-3
img-4
but i just print
img-2
img-3
img-4
what should I do?
<?php
$images = $page->images()->sortBy('sort', 'asc');
foreach($images as $img): ?>
print images...
<?php endforeach ?>
Now it print all image in this page.
img-1
img-2
img-3
img-4
but i just print
img-2
img-3
img-4
what should I do?
<?php
$images = $page->images()->sortBy('sort', 'asc');
$first = $images->first();
$images = $images->not($first);
foreach($images as $img): ?>
//print images...
<?php endforeach ?>
Wow, very fast and good! Thank you!!!
On a side note: $images
here is not an array but a Files object…
you are right.
and can I customize the number one?
ex. i want print img 3-4 or 1-2.
use nth(num)?
nt()
only gives you a single image, but you can work with offset()
and limit()
.