我需要添加显示更多/显示更少的链接/按钮以拉出第二批徽标图像,然后再次重复该链接/按钮一次或两次。
<?php //return ?>
<?php
$count = 0;
$imagesArray = array();
foreach (glob("images/our-clients/*.*") as $filename) {
$imagesArray = array_add($imagesArray, $count, $filename);
$count++;
}
function uniRandNumber ($seedStart, $seedEnd, $returnAmount) {
$randarray = array();
for($i = 1; $i <= $returnAmount; )
{
unset($rand);
$rand = rand(1, $seedEnd);
if(!in_array($rand, $randarray))
{
$randarray[] = $rand;
$i++;
}
}
$randstr = implode(", ", $randarray);
return $randstr;
}
$uniRandArray = array();
$uniRandArray = explode(',', uniRandNumber ( 0, $count-1, 10));
?>
<div>
<div class="container">
<div class="row client-list-heading-row">
<div class="col">
@php $h2Text = 'Our Customers'; @endphp
@include('partials.layouts.tag-h2')
{{-- <span class="subtitle-to-h2text">We work with a wide range of clients across all industries. Some of our clients include:</span> --}}
</div>
</div>
<div class="row client-list-row">
<?php
$count = 0;
foreach ($uniRandArray as $uniRandArrayDump) {
echo "<div class='col object-grey-scale-hover client-list-logo-wrapper'>";
echo "<img class='client-list-imgage' src='" . $imagesArray[(int)$uniRandArrayDump] . "' />";
echo "</div>";
$count++;
}
?>
</div>
</div>
</div>
最终结果应允许用户单击“显示更多”按钮,该按钮现在显示剩余的徽标图像,而不是原始的徽标图像。