Php 如何将带有覆盖的HTML输出放在OwlCarousel中

Php 如何将带有覆盖的HTML输出放在OwlCarousel中,php,jquery,html,css,owl-carousel,Php,Jquery,Html,Css,Owl Carousel,我的页面中有一个滑块,每个滑块都有自己的覆盖描述,这些描述是HTML格式的 在我的管理模块中,有一个设置,用户可以使用CKEditor使用自定义消息创建自己的滑块图像 我的问题是,当我试图在滑块中显示描述时,它只是简单的HTML代码 以下是我的一些代码: 控制器部件 foreach($results as $result) { if ($result['banner_image'] && file_exists(DIR_IMAGE . $result['

我的页面中有一个滑块,每个滑块都有自己的覆盖描述,这些描述是HTML格式的

在我的管理模块中,有一个设置,用户可以使用CKEditor使用自定义消息创建自己的滑块图像

我的问题是,当我试图在滑块中显示描述时,它只是简单的HTML代码

以下是我的一些代码:

控制器部件

foreach($results as $result) {

            if ($result['banner_image'] && file_exists(DIR_IMAGE . $result['banner_image'])) {
                $image = $this->model_tool_image->resize($result['banner_image'], 40, 40);
                $banner_image_large = HTTP_IMAGE . $result['banner_image'];
            } else {
                $image = $this->model_tool_image->resize('no_image.jpg', 40, 40);
            }

            $url = '&banner_id=' . (int)$result['banner_id'];

            $this->data['banners'][] = array(
                'banner_id' => $result['banner_id'],
                'banner_image' => $image,
                'banner_image_large' => $banner_image_large, // here's the image to be use in the slider
                'code_description' => $result['banner_description'], //here's the raw HTML formatted description
                'description' => strip_tags(html_entity_decode($result['banner_description'])),
                'banner_link' => $result['banner_link'],
                'action' => $this->url->link('project/banner_slider/update', 'token=' . $this->session->data['token'] . $url, 'SSL')
            );

        }
在我看来

<h1>Carousel Demo</h1>

    <div id="owl-demo" class="owl-carousel owl-theme">
        <?php foreach($banners as $banner) { ?>
            <div class="item">
                <div class="textoverlay"><?php echo $banner['code_description']; ?></div> <!-- overlay the decription -->
                <img src="<?php echo $banner['banner_image_large']; ?>" />
            </div>
        <?php } ?>
    </div>
和JS:

$('#owl-demo').owlCarousel({
    autoPlay : 3000,
    stopOnHover : true,
    navigation : false, // Show next and prev buttons
    slideSpeed : 300,
    paginationSpeed : 400,
    singleItem:true,
    autoHeight : true,
    transitionStyle:"fade"
});

$.parseHTML(“此处的html”)包围原始html

好的,我用html\u entity\u decode()函数解决了这个问题,顺便问一下,我应该把它放在视图部分或控制器的什么位置?
$('#owl-demo').owlCarousel({
    autoPlay : 3000,
    stopOnHover : true,
    navigation : false, // Show next and prev buttons
    slideSpeed : 300,
    paginationSpeed : 400,
    singleItem:true,
    autoHeight : true,
    transitionStyle:"fade"
});