zoukankan      html  css  js  c++  java
  • dede 添加 栏目缩略图

    一.

    涉及到文件如下(注意备份)

    dede/catalog_add.php

    dede/catalog_edit.php

    dede/templets/catalog_add.htm

    dede/templets/catalog_edit.htm

    二、打开文件夹/templets目录(模板),在里面新建一个文件夹typeimg,用于独立存放栏目缩略图

    三.

    新加字段 typeimg

    后台执行SQL(前缀默认为dede_ 具体前缀根据自己网站修改):

    alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';

    四.打开dede/catalog_add.php

    查找(ctrl+f):

    $queryTemplate = "insert into `dede_arctype`

    1、将:

    (reid,topid,sortrank,typename,typedir,

    替换为:

    (reid,topid,sortrank,typename,typedir,typeimg,

    2、将:

    ('~reid~','~topid~','~rank~','~typename~','~typedir~',

    替换为:

    ('~reid~','~topid~','~rank~','~typename~','~typedir~','~typeimg~',

    五、

    打开dede/catalog_edit.php

    查找(ctrl+f):

    $upquery = "Update `dede_arctype` set

    在其下面新加一行:

    `typeimg`='$typeimg',

    六、打开dede/templets/catalog_add.htm

    贴上代码:

    <tr>
                <td height="65" style="padding-left:10px;">栏目图片:</td>
                <td height="65">
                <input name="typeimg" type="text" sytle="250px" id="typeimg" class="alltxt" value="">
                <input type="button" name="set9" value="浏览..." class="coolbg np" style=" 60px" onclick="SelectTemplets('form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes');">
                {请先将图片上传至/templets/typeimg下,再进行选择}
                </td>
              </tr>

    七、

    打开dede/templets/catalog_edit.htm

    贴上代码:

    <tr>
                <td height="65" style="padding-left:10px;">栏目图片:</td>
                <td height="65">
                <input name="typeimg" type="text" sytle="250px" id="typeimg" class="alltxt" value="<?php echo $myrow['typeimg']?>">
                <input type="button" name="set9" value="浏览..." class="coolbg np" style=" 60px" onclick="SelectTemplets('form1.typeimg&activepath=%2Ftemplets%2Ftypeimg&img=yes');">
                {请先将图片上传至/templets/typeimg下,再进行选择}
                </td>
              </tr>

    八、完成!后台-》栏目-》高级选项中会多出“栏目图片”选项,添加其他自定义选项也是如此步骤

    另外:文章页面调用栏目缩略图 方法:

    打开includearc.archives.class.php

    查找(ctrl+f)下面代码:

    if($this->ChannelUnit->ChannelInfos['issystem']!=-1)

    将:

    $query = "Select arc.*,tp.reid,tp.typedir,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id='$aid' "; 

    $this->Fields = $this->dsql->GetOne($query);

    替换为:

    $query = "Select arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable 

    from `dede_archives` arc 

    left join dede_arctype tp on tp.id=arc.typeid 

    left join dede_channeltype as ch on arc.channel = ch.id 

    where arc.id='$aid' "; 

    $this->Fields = $this->dsql->GetOne($query);

    这样可以直接在文章内容页也调用栏目缩略图了。

  • 相关阅读:
    Django 的 CSRF 保护机制
    操作系统下spinlock锁解析、模拟及损耗分析
    .Net中的并行编程-1.路线图(转)
    [leetcode] 小心成环
    [leetcode] 题型整理之图论
    [leetcode] 提醒整理之进制
    [leetcode] 题型整理之二叉树
    [leetcode] 题型整理之查找
    [leetcode] 一些会的
    [leetcode] 题型整理之排序
  • 原文地址:https://www.cnblogs.com/haohaosky/p/6372038.html
Copyright © 2011-2022 走看看