📁 File Manager
Editing:
/home/wedigitalindia/public_html/video.php
<?php include("admin/connection.php"); include('include/header.php'); ?> <!--Page Header Start--> <section class="page-header"> <div class="page-header__bg" style="background-image: url(<?php path() ?>assets/images/backgrounds/page-header-bg.jpg);"> </div> <div class="page-header__shape-1"> <img src="<?php path() ?>assets/images/shapes/page-header-shape-1.png" alt=""> </div> <div class="container"> <div class="page-header__inner"> <h3>Our Videos</h3> <div class="thm-breadcrumb__inner"> <ul class="thm-breadcrumb list-unstyled"> <li><a href="<?php path() ?>index.php">Home</a></li> <li><span class="fas fa-angle-right"></span></li> <li>Our Videos</li> </ul> </div> </div> </div> </section> <!--Page Header End--> <!--About One Start --> <section class="about-one mb-5"> <div class="container"> <div class="row gallery"> <?php $gallery = mysqli_query($con, "SELECT * FROM media WHERE page_name = 'Video' ORDER BY id DESC"); while ($row = mysqli_fetch_array($gallery)) { $photo = $row['photo']; // uploaded video file $caption = $row['caption']; // video link (YouTube / Vimeo / Others) $video_path = 'admin/assets/images/gallery/' . $photo; ?> <div class="col-md-12 col-lg-3 mb-4"> <?php // ✅ Uploaded video file if (!empty($photo) && file_exists($video_path)) { ?> <video style="width: 100%; height: 250px; border-radius: 8px;" controls> <source src="<?php echo $video_path; ?>" type="video/mp4"> Your browser does not support the video tag. </video> <?php } // ✅ Embedded YouTube / Vimeo links elseif (!empty($caption)) { // YouTube if (strpos($caption, 'youtube.com') !== false || strpos($caption, 'youtu.be') !== false) { parse_str(parse_url($caption, PHP_URL_QUERY), $youtube_params); $youtube_id = $youtube_params['v'] ?? ''; // handle short links (youtu.be/xxxx) if (!$youtube_id && strpos($caption, 'youtu.be') !== false) { $youtube_id = basename(parse_url($caption, PHP_URL_PATH)); } if ($youtube_id) { ?> <iframe width="100%" height="250" src="https://www.youtube.com/embed/<?php echo $youtube_id; ?>" frameborder="0" allowfullscreen style="border-radius: 8px;"></iframe> <?php } else { ?> <a href="<?php echo htmlspecialchars($caption); ?>" target="_blank">View Video</a> <?php } } // Vimeo elseif (strpos($caption, 'vimeo.com') !== false) { $vimeo_id = basename(parse_url($caption, PHP_URL_PATH)); ?> <iframe src="https://player.vimeo.com/video/<?php echo $vimeo_id; ?>" width="100%" height="250" frameborder="0" allowfullscreen style="border-radius: 8px;"></iframe> <?php } // Other links else { ?> <a href="<?php echo htmlspecialchars($caption); ?>" target="_blank">View Video</a> <?php } } // ✅ No video available else { ?> <p>No video available.</p> <?php } ?> </div> <?php } ?> </div> </div> </section> <!--About One End --> <?php include("include/footer.php"); ?>
Save
Cancel