So I have a code that is responsive in nature that is supposed to places four (4) photos side by side and shows the photos at random order.
However, because I am just starting out I don't know how to create a code that makes sure there are only four (4) photos shown at any given time???
So based on my code provided below how do I only show four photos at a time. (Even though I want there to be at least eight (8) possible photos that it sorts through.)
CODE USED:
<br>
<br>
<h50><?php echo $this->translate('Be Discovered!'); ?></h50>
and connected. Meet anyone & see everything!</a></p>
<br>
<?php
$pics = [
"/public/admin/haleyfoxforabout333.jpg",
"/public/admin/haleyfoxforabout333.jpg",
"/public/admin/team5aboutG333.jpg",
"/public/admin/team6about333.jpg",
"https://www.w3schools.com/w3images/team1.jpg",
"https://www.w3schools.com/w3images/team2.jpg",
"https://www.w3schools.com/w3images/team3.jpg",
"/public/admin/team4_333.jpg"
];
shuffle($pics);
?>
<style>
h50 {
padding: 0 30px 8px;
width: auto;
font-size: 40px;
margin: 0 0 10px 0;
background-color: transparent;
border: none;
border-bottom: 1px solid #D2DBE8;
border-radius: 3px 3px 0 0;
display: inline-block;
}
.headerz {
text-align: center;
padding: 32px;
}
.rowz {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
padding: 0 4px;
}
/* Create four equal columns that sits next to each other */
.columnz {
-ms-flex: 25%; /* IE10 */
flex: 25%;
max-width: 25%;
padding: 0 4px;
}
.columnz img {
margin-top: 8px;
vertical-align: middle;
}
/* RL - makes a two column-layout instead of four columns */
@media screen and (max-width: 800px) {
.columnz {
-ms-flex: 50%;
flex: 50%;
max-width: 50%;
}
}
/* RL Takes the two columns stack on top of each other. */
@media screen and (max-width: 600px) {
.columnz {
-ms-flex: 100%;
flex: 100%;
max-width: 100%;
}
}
</style>
<!-- Photo Grid -->
<div class="rowz">
<?php
foreach ($pics as $pic) {
echo '<div class="columnz">';
echo '<img src="' . $pic . '" style="width:100%">';
echo '</div>';
}
?>
</div>