-3
Someone has a simple solution to loop while in PHP to the following HTML structure?
Basically I want every 3 Ivs to have one <li>
separating them so that the slide can function properly, since each <li>
works as a "new page". A template page, If you look at the source code, it’s quite complete and easy to understand.
PHP code
<?php
$fotosEmpresa = $conn->prepare("SELECT * FROM imgs_global WHERE TipoImg = ? ORDER BY rand()");
$fotosEmpresa->execute(array("QuemSomos"));
if($fotosEmpresa->rowCount() > 0): ?>
<ul class="bxslider">
<li>
<div class="row">
<?php while($rowFotoEmpresa = $fotosEmpresa->fetch(PDO::FETCH_OBJ)): ?>
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<a href="administracao/imagens/quemsomos/imgG/<?php echo $rowFotoEmpresa->NomeImg; ?>" class="zoom">
<img alt="" src="administracao/imagens/quemsomos/<?php echo $rowFotoEmpresa->NomeImg; ?>">
</a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</li>
</ul>
<?php endif; ?>
HTML structure
<ul class="bxslider">
<li>
<div class="row">
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<img alt="" src="http://placehold.it/300x378">
</div>
<h2>John Smith</h2>
<span>Webdesigner</span>
</div>
</div>
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<img alt="" src="http://placehold.it/300x378">
</div>
<h2>Mike Smith</h2>
<span>Founder of a Company</span>
</div>
</div>
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<img alt="" src="http://placehold.it/300x378">
</div>
<h2>Donald Smith</h2>
<span>Development</span>
</div>
</div>
</div>
</li>
<li>
<div class="row">
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<img alt="" src="http://placehold.it/300x378">
</div>
<h2>John Smith</h2>
<span>Webdesigner</span>
</div>
</div>
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<img alt="" src="http://placehold.it/300x378">
</div>
<h2>Mike Smith</h2>
<span>Founder of a Company</span>
</div>
</div>
<div class="col-md-4">
<div class="team-post">
<div class="team-gal">
<img alt="" src="http://placehold.it/300x378">
</div>
<h2>Donald Smith</h2>
<span>Development</span>
</div>
</div>
</div>
</li>
</ul>
We saw that each <li>
which repeats a new "page" is generated for the slider, that is, in the structure it needs to treat that to each X number of records it generates a <li>
, something like.
Put your code (php) that you tried, and we can help you. ".
– Marcelo Aymone
Where does the content come from
h2
andspan
? the images are all the same, this content is also different eachteam-post
? (your link doesn’t work for me...)– Sergio
Clarify your specific issue or add other details to highlight exactly what you need. The way it’s written here, it’s hard to know exactly what you’re asking. See the How to Ask page for help clarifying this question.
– Marcelo Aymone
Basically what he wants is, looking at the above structure, that every 3 times they are separated by a li to be able to arrive at the result of the slide that he put as a model.
– Diego Vieira
Yes, we understand what he wants, the problem is exactly this. In addition to wanting a ready answer, without having work, not even posted the details so we can help to give an answer, your answer for example, would be complete if it informed correctly, the database data, how is his php, etc. Sopt or Soen, are totally against providing work ready, we are not a free programming community.
– Marcelo Aymone
@Marceloaymone I agree with you, the question is very vague.
– Diego Vieira
I have php code, I just can’t edit the question anymore because they put it on hold. What I want is very simple and @Diegovieira understood correctly, the html structure is a template but obviously in php the images and text come from the database. I believe the question was very simple and easy to understand but, I have php code, and it was not a question like "do it for me", it was like, collaborate with suggestions please.
– Tiago Boeing
Then it would fit in another reason to suspend the question, because it is based on opinions.
– Marcelo Aymone