zblog后台设置幻灯片功能实现

admin2023-01-181153

幻灯片在后台主题设置里控制幻灯片的代码比较多,最好单独建立一个选项卡,效果如图。

QQ截图20180621215509.jpg

界面设置代码slide.php

<?php
require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';
$zbp->Load();
$action='root';
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}
if (!$zbp->CheckPlugin('dipper_pcqxw')) {$zbp->ShowError(48);die();}
$blogtitle='主题配置';
require $blogpath . 'zb_system/admin/admin_header.php';
require $blogpath . 'zb_system/admin/admin_top.php';
/***上面代码通用也必用,前面已经讲过**/

/***下面这段代码用于判断是否使用百度编辑器,使用了则引入**/
if ($zbp->CheckPlugin('UEditor')) {
    echo '<script type="text/javascript" src="'.$zbp->host.'zb_users/plugin/UEditor/ueditor.config.php"></script>';
    echo '<script type="text/javascript" src="'.$zbp->host.'zb_users/plugin/UEditor/ueditor.all.min.js"></script>';
}
?>
    /***引入当前界面的css样式**/
    <link rel="stylesheet" href="style/css/xf-style.css" type="text/css" media="all"/>
    /***增加幻灯片的功能的实现**/
    <script>
        function upwindow(){
            var container = document.createElement('script');
            $(container).attr('type','text/plain').attr('id','img_editor');
            $("body").append(container);
            _editor = UE.getEditor('img_editor');
            _editor.ready(function () {
                _editor.hide();
                $(".xf-uploadimg strong").click(function(){
                    object = $(this).parent().find('.uplod_img');
                    _editor.getDialog("insertimage").open();
                    _editor.addListener('beforeInsertImage', function (t, arg) {
                        object.attr("value", arg[0].src);
                    });
                });
            });
        }
        upwindow();
    </script>
    /***当前页面的html代码**/
    <div id="divMain">
        <div class="xf-submenu">
            <ul>
                <?php dipper_pcqxw_SubMenu(1);?>
                <li><a href="https://www.songhaifeng.com/zblogphp-charge-theme/108.html" target="_blank"><span>技术支持</span></a></li>
            </ul>
        </div>
        <div id="divMain2">
            <?php
            $str = '';
            $str .= '<form action="save.php?type=flash" method="post">';
            $str .= '<div class="xf-content">';
            $str .= '<div class="xf-content-img">';
            $str .= '  <div class="xf-box xf-box-img">';
            $str .= '        <div class="xf-box-img-text">';
            $str .= '           <span class="xf-title">幻灯标题:</span>';
            $str .= '           <input type="text" name="title" class="xf-input-img sedit" value="" />';
            $str .= '        </div>';
            $str .= '     </div>';
            $str .= '     <div class="xf-box xf-box-img xf-uploadimg">';
            $str .= '        <div class="xf-box-img-text">';
            $str .= '           <span class="xf-title">幻灯图片地址:</span>';
            $str .= '           <input name="img" type="text" class="uplod_img xf-uplod-img xf-sider-uploadimg" value="" /><strong class="button">浏览文件</strong>';
            $str .= '        </div>';
            $str .= '     </div>';
            $str .= '     <div class="xf-box xf-box-img xf-uploadimg">';
            $str .= '        <div class="xf-box-img-text">';
            $str .= '           <span class="xf-title">幻灯链接地址:</span>';
            $str .= '           <input type="text" name="url" class="xf-input-img sedit" value="" />';
            $str .= '        </div>';
            $str .= '     </div>';
            $str .= '     <div class="xf-box xf-box-img">';
            $str .= '        <div class="xf-box-img-text">';
            $str .= '           <span class="xf-title">幻灯显示:</span>';
            $str .= '           <input type="text" class="checkbox" name="IsUsed" value="1" />';
            $str .= '        </div>';
            $str .= '     </div>';
            $str .= '     <div class="xf-box xf-box-img xf-img-button">';
            $str .= '        <span class="xf-title">幻灯排序:</span>';
            $str .= '        <input type="text" name="order" class="xf-input-img sedit" value="99" />';
            $str .= '        <input name="editid" type="hidden" class="xf-button" value=""/>';
            $str .= '        <input name="add" type="submit" class="xf-button button" value="增加"/>';
            $str .= '     </div>';
            $str .= '</div>    ';
            $str .= '</div>    ';
            $str .= '</form>';
            $where = array(array('=','sean_Type','0'),array('<>','sean_Img',''));
            $order = array('sean_IsUsed'=>'DESC','sean_Order'=>'ASC');
            $sql= $zbp->db->sql->Select($XF_News_UC_Table,'*',$where,$order,null,null);
            $array=$zbp->GetListCustom($XF_News_UC_Table,$XF_News_UC_DataInfo,$sql);
            foreach ($array as $key => $reg) {
                $str .= '<form action="save.php?type=flash" method="post" name="flash">';
                $str .= '  <div class="xf-content">';
                $str .= '     <div class="xf-content-img">';
                $str .= '        <div class="xf-box xf-box-img">';
                $str .= '           <div class="xf-box-img-text">';
                $str .= '              <span class="xf-title">幻灯标题:</span>';
                $str .= '              <input type="text" name="title" class="xf-input-img sedit" value="'.$reg->Title.'" />';
                $str .= '           </div>';
                $str .= '        </div>';
                $str .= '        <div class="xf-box xf-box-img xf-uploadimg">';
                $str .= '           <div class="xf-box-img-text">';
                $str .= '              <span class="xf-title">幻灯图片地址:</span>';
                $str .= '              <input name="img" type="text" class="uplod_img xf-uplod-img xf-sider-uploadimg" value="'.$reg->Img.'" /><strong class="button">浏览文件</strong>';
                $str .= '           </div>';
                $str .= '        </div>';
                $str .= '        <div class="xf-box xf-box-img">';
                $str .= '           <div class="xf-box-img-text">';
                $str .= '              <span class="xf-title">幻灯链接地址:</span>';
                $str .= '              <input type="text" name="url" class="xf-input-img sedit" value="'.$reg->Url.'" />';
                $str .= '           </div>';
                $str .= '        </div>';
                $str .= '        <div class="xf-box xf-box-img">';
                $str .= '           <div class="xf-box-img-text">';
                $str .= '              <span class="xf-title">幻灯显示:</span>';
                $str .= '              <input type="text" class="checkbox" name="IsUsed" value="'.$reg->IsUsed.'" />';
                $str .= '           </div>';
                $str .= '        </div>';
                $str .= '        <div class="xf-box xf-box-img xf-img-button">';
                $str .= '           <span class="xf-title">幻灯排序:</span>';
                $str .= '           <input type="hidden" name="editid" value="'.$reg->ID.'">';
                $str .= '           <input type="text" name="order" class="xf-input-img sedit" value="'.$reg->Order.'" />';
                $str .= '           <input name="edit" type="Submit" class="xf-button button" value="修改"/>';
                $str .= '           <input name="del" type="button" class="xf-button button" value="删除" onclick="if(confirm(\'您确定要进行删除操作吗?\')){location.href=\'save.php?type=flashdel&id='.$reg->ID.'\'}"/>';
                $str .= '        </div>';
                $str .= '     </div>';
                $str .= '     <div class="clearfix"></div>';
                $str .= '  </div>';
                $str .= '</form>';
            }
            $str .='</table>';
            echo $str;
            ?>
        </div>
    </div>
    /***下面通用也必用,之前讲过**/
    <script type="text/javascript">
        ActiveTopMenu("topmenu_dipper_pcqxw");//"topmenu_主题名称"
    </script>
<?php
require $blogpath . 'zb_system/admin/admin_footer.php';
RunTime();
?>

当前页面css样式代码

@charset "utf-8";
.clearfix {
    zoom:1
}
.clearfix:after {
    content: '\20';
    display: block;
    clear: both;
}
.xf-content-img {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.xf-content-img .xf-box-img {
    padding: 2px 0;
    border-bottom: 0px solid #eee;
}
.xf-content-img .xf-box-img .xf-title {
    margin-top: 2px;
}
.xf-input-img {
    width: 38%;
}
.xf-box-img .xf-button[type="submit"],.xf-box-img .xf-button[type="button"] {
    width: 102px;
}
.xf-img-button .xf-input-img{
    width: 66px;
}
.xf-box-img-text .imgcheck {
    margin-top: 4px;
}
.explain .xf-box {
    border-bottom: 0 solid #eee;
    padding: 16px 0 0 0;
}
.xf-content{
    box-sizing: border-box;
    margin: 16px 0 22px 0;
    border: 1px solid #eeeeee;
padding: 0 2%;
    zoom: 1;
}

.xf-box {
    clear: both;
    padding: 16px 0;
position: relative;
min-height: 1px;
    border-bottom: 1px solid #eee;
box-sizing: border-box;
}

.xf-title{
    margin-top: 6px;
width: 23%;
float: left;
display: block;
color: #555;
    font-weight: 700;
text-align: right;
padding-right: 15px;
}


网友评论