0
I have the following code:
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<?php
include 'conexao.php';
$consulta = $PDO->query("SELECT * FROM imoveis WHERE id='$imovelid';");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
$pasta = "painel/galeria/$linha[fotos]/";
$imagens = glob("$pasta/{*.jpg,*.JPG,*.png,*.PNG}",GLOB_BRACE);
foreach($imagens as $img){ ?>
<div class="carousel-inner">
<div class="item active">
<img src="<?php echo $img ?>" alt="<?php echo "$linha[titulo]"; ?>">
</div>
<div class="item">
<img src="<?php echo $img ?>" alt="<?php echo "$linha[titulo]"; ?>">
</div>
</div>
<? } } ?>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
When generating the slider with the images coming from the folder, which is previously registered in a database field, my result is as follows:
Images get stacked, instead of passing one at a time.
I’ve tried to change the location to open and close div’s, but I haven’t had much success.
Any hint?
Make sure you are importing all bootstrap dependencies correctly
– Marcelo Zapatta
Thanks for the prompt reply. Everything ok,
css
andjs
set correctly.– Hebert Richard Masseno Dias
I can’t take it! Why negatively? Where the question is out of scope or unnecessary?
– Hebert Richard Masseno Dias