不显示bootstrap幻灯片显示文本

时间:2017-12-04 09:56:18

标签: php twitter-bootstrap

我正在为我的主页开发一个带文本的幻灯片图像。图像工作正常但文本没有显示。我使用PHP和mysqli的bootstrap我尝试下面的代码我粘贴它。请仔细阅读编码,找到合适的解决方案,为什么文本没有显示。请解决此问题

 <?php  include("includes/db.php");  ?>
<div class="main-slider-area home-4-main-slaider-area entire-home-main-slider home-5-main-slaider-area">
                    <!-- Main Slider -->

                        <div class="main-slider">
                            <div class="slider">


                                <div id="mainSlider" class="nivoSlider slider-image">
                                               <?php

                                                $get_slides = "select * from slider LIMIT 0,1";

                                                $run_slides = mysqli_query($con,$get_slides);

                                                while($row_slides=mysqli_fetch_array($run_slides)){

                                                    $slide_name = $row_slides['slide_name'];
                                                    $slide_text = $row_slides['slide_text'];

                                                    $slide_url = $row_slides['slide_url'];

                                                    echo "

                                                        <div class='item active'>

                                                        <a><img src='img/slider/$slide_name' ></a>

                                                        </div>

                                                        ";

                                                ?>

                                                <?php

                                                $get_slides = "select * from slider LIMIT 1,3 ";

                                                $run_slides = mysqli_query($con,$get_slides);

                                                while($row_slides = mysqli_fetch_array($run_slides)) {


                                                    $slide_name = $row_slides['slide_name'];
                                                    $slide_text = $row_slides['slide_text'];

                                                    $slide_url = $row_slides['slide_url'];

                                                    echo "

                                                        <div class='item'>

                                                        <a><img src='img/slider/$slide_name' alt='main slider' title='#htmlcaption1' ></a>

                                                        </div>

                                                        ";


                                                ?>

                                </div>

                                <!-- Slider Caption One -->
                                <div id="htmlcaption1" class="nivo-html-caption slider-caption-1">
                                    <div class="slider-progress"></div>                                 
                                    <div class="slide-text">
                                        <div class="middle-text">
                                            <div class="cap-dec">
                                                <h1 class="cap-dec wow zoomInRight" data-wow-duration="1.1s" data-wow-delay="0s"><?php $slide_text; ?></h1>


                                            </div>
                                            <div class="cap-readmore wow zoomInRight" data-wow-duration=".9s" data-wow-delay=".5s">
                                                <a href="#"><?php $slide_url; ?></a>
                                            </div>  
                                        </div>  
                                    </div>
                                </div>
                                <!-- Slider Caption Two -->
        <?php } }?>
                            </div>
                        </div><!-- End Main Slider -->
                    </div><!-- End Main Slider Area -->     

1 个答案:

答案 0 :(得分:0)

这是因为您缺少打印$slider_text,您必须在保留图像的<div>内打印。

<div class="main-slider">
                        <div class="slider">


                            <div id="mainSlider" class="nivoSlider slider-image">
                                           <?php

                                            $get_slides = "select * from slider LIMIT 0,1";

                                            $run_slides = mysqli_query($con,$get_slides);

                                            while($row_slides=mysqli_fetch_array($run_slides)){

                                                $slide_name = $row_slides['slide_name'];
                                                $slide_text = $row_slides['slide_text'];

                                                $slide_url = $row_slides['slide_url'];

                                                echo "

                                                    <div class='item active'>

                                                    <a><img src='img/slider/$slide_name' ></a><p>$slider_text</p>

                                                    </div>";// here i print the $slider_text
  </div>  
                                    </div>  
                                </div>