ramiwahdan Posted June 15, 2020 Share Posted June 15, 2020 Hi, I have made picture slideshow and included many pictures for the slideshow but i also added a video, how to make it apear as it is not appearing. code: <?php //index.php $connect = mysqli_connect("dbhost", "dbuser", "dbpassword", "dbname"); function make_query($connect) { $query = "SELECT * FROM banner ORDER BY banner_id ASC"; $result = mysqli_query($connect, $query); return $result; } function make_slide_indicators($connect) { $output = ''; $count = 0; $result = make_query($connect); while($row = mysqli_fetch_array($result)) { if($count == 0) { $output .= ' <li data-target="#dynamic_slide_show" data-slide-to="'.$count.'" class="active"></li> '; } else { $output .= ' <li data-target="#dynamic_slide_show" data-slide-to="'.$count.'"></li> '; } $count = $count + 1; } return $output; } function make_slides($connect) { $output = ''; $count = 0; $result = make_query($connect); while($row = mysqli_fetch_array($result)) { if($count == 0) { $output .= '<div class="item active">'; } else { $output .= '<div class="item">'; } $output .= ' <img src="banner/'.$row["banner_image"].'" alt="'.$row["banner_title"].'" /> <div class="carousel-caption"> <h3>'.$row["banner_title"].'</h3> </div> </div> '; $count = $count + 1; } return $output; } ?> <!DOCTYPE html> <html> <head> <title>How to Make Dynamic Bootstrap Carousel with PHP</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <br /> <div class="container"> <h2 align="center">How to Make Dynamic Bootstrap Carousel with PHP</h2> <br /> <div id="dynamic_slide_show" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <?php echo make_slide_indicators($connect); ?> </ol> <div class="carousel-inner"> <?php echo make_slides($connect); ?> </div> <a class="left carousel-control" href="#dynamic_slide_show" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#dynamic_slide_show" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div> </div> </body> </html> in the database i have the names of the photos from 1 to 5 then a video. The photos are shown but the video is not showing. Is there a way to include it in the slideshow? If not, is it possible to have a video player instead. Thanks. Quote Link to comment Share on other sites More sharing options...
requinix Posted June 15, 2020 Share Posted June 15, 2020 $output .= ' <img src="banner/'.$row["banner_image"].'" alt="'.$row["banner_title"].'" /> <div class="carousel-caption"> <h3>'.$row["banner_title"].'</h3> </div> </div> '; Obviously you need to change that, right? Figure out what HTML markup you need to show a video, then change your code so that it (a) knows whether the item to display is an image or video, then (b) puts the appropriate markup into $output. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.