>  기사  >  php教程  >  Dedecms 백엔드 열에 그림 추가

Dedecms 백엔드 열에 그림 추가

WBOY
WBOY원래의
2016-09-23 11:13:051074검색

프런트 데스크에서 칼럼 호출 시 아이콘이 표시되어야 합니다.

1단계: "시스템->SQL 명령 도구", sql 문 삽입

alter table dede_arctype add imgtype varchar(<span style="color: #800080;">100</span>)

2단계: 백그라운드 관리 파일 디렉터리(기본값: dede 디렉터리)를 입력하고 "catelog_add.php"에서 228행을 찾아 다음을 기본값으로 바꿉니다(SQL 문에 "typeimg" 추가).

    <span style="color: #800080;">$in_query</span> = "<span style="color: #000000;">INSERT INTO `#@__arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,
    tempindex,templist,temparticle,modname,namerule,namerule2,
    ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`,`typeimg`)
    VALUES('</span><span style="color: #800080;">$reid</span>','<span style="color: #800080;">$topid</span>','<span style="color: #800080;">$sortrank</span>','<span style="color: #800080;">$typename</span>','<span style="color: #800080;">$typedir</span>','<span style="color: #800080;">$isdefault</span>','<span style="color: #800080;">$defaultname</span>','<span style="color: #800080;">$issend</span>','<span style="color: #800080;">$channeltype</span><span style="color: #000000;">',
    '</span><span style="color: #800080;">$tempindex</span>','<span style="color: #800080;">$templist</span>','<span style="color: #800080;">$temparticle</span>','default','<span style="color: #800080;">$namerule</span>','<span style="color: #800080;">$namerule2</span><span style="color: #000000;">',
    '</span><span style="color: #800080;">$ispart</span>','<span style="color: #800080;">$corank</span>','<span style="color: #800080;">$description</span>','<span style="color: #800080;">$keywords</span>','<span style="color: #800080;">$seotitle</span>','<span style="color: #800080;">$moresite</span>','<span style="color: #800080;">$siteurl</span>','<span style="color: #800080;">$sitepath</span>','<span style="color: #800080;">$ishidden</span>','<span style="color: #800080;">$cross</span>','<span style="color: #800080;">$crossid</span>','<span style="color: #800080;">$content</span>','<span style="color: #800080;">$smalltypes</span>','<span style="color: #800080;">$typeimg</span>')";

3단계: "catelog_edit.php"에서 36행을 찾아 다음을 기본값으로 바꿉니다(SQL 문에 "typeimg" 추가).

    <span style="color: #800080;">$upquery</span> = "<span style="color: #000000;">UPDATE `#@__arctype` SET
     issend='</span><span style="color: #800080;">$issend</span><span style="color: #000000;">',
     sortrank='</span><span style="color: #800080;">$sortrank</span><span style="color: #000000;">',
     typename='</span><span style="color: #800080;">$typename</span><span style="color: #000000;">',
     typedir='</span><span style="color: #800080;">$typedir</span><span style="color: #000000;">',
     isdefault='</span><span style="color: #800080;">$isdefault</span><span style="color: #000000;">',
     defaultname='</span><span style="color: #800080;">$defaultname</span><span style="color: #000000;">',
     issend='</span><span style="color: #800080;">$issend</span><span style="color: #000000;">',
     ishidden='</span><span style="color: #800080;">$ishidden</span><span style="color: #000000;">',
     channeltype='</span><span style="color: #800080;">$channeltype</span><span style="color: #000000;">',
     tempindex='</span><span style="color: #800080;">$tempindex</span><span style="color: #000000;">',
     templist='</span><span style="color: #800080;">$templist</span><span style="color: #000000;">',
     temparticle='</span><span style="color: #800080;">$temparticle</span><span style="color: #000000;">',
     namerule='</span><span style="color: #800080;">$namerule</span><span style="color: #000000;">',
     namerule2='</span><span style="color: #800080;">$namerule2</span><span style="color: #000000;">',
     ispart='</span><span style="color: #800080;">$ispart</span><span style="color: #000000;">',
     corank='</span><span style="color: #800080;">$corank</span><span style="color: #000000;">',
     description='</span><span style="color: #800080;">$description</span><span style="color: #000000;">',
     keywords='</span><span style="color: #800080;">$keywords</span><span style="color: #000000;">',
     seotitle='</span><span style="color: #800080;">$seotitle</span><span style="color: #000000;">',
     moresite='</span><span style="color: #800080;">$moresite</span><span style="color: #000000;">',
     `cross`='</span><span style="color: #800080;">$cross</span><span style="color: #000000;">',
     `content`='</span><span style="color: #800080;">$content</span><span style="color: #000000;">',
     `crossid`='</span><span style="color: #800080;">$crossid</span><span style="color: #000000;">',
     `typeimg`='</span><span style="color: #800080;">$typeimg</span><span style="color: #000000;">',
     `smalltypes`='</span><span style="color: #800080;">$smalltypes</span><span style="color: #000000;">'
     </span><span style="color: #800080;">$uptopsql</span><span style="color: #000000;">
    WHERE id='</span><span style="color: #800080;">$id</span>' ";

4단계: 백그라운드 관리 파일 디렉터리(기본값: dede 디렉터리)/templets/에 "catalog_add.htm 및 Catalog_edit.htm" 파일을 입력한 후 다음 코드를 추가합니다.

<span style="color: #0000ff;"><</span><span style="color: #800000;">script </span><span style="color: #ff0000;">language</span><span style="color: #0000ff;">='javascript' </span><span style="color: #ff0000;">src</span><span style="color: #0000ff;">="js/main.js"</span><span style="color: #0000ff;">></</span><span style="color: #800000;">script</span><span style="color: #0000ff;">></span>

그리고 배치하려는 위치에 다음 코드를 추가하세요.

            <span style="color: #0000ff;"><</span><span style="color: #800000;">tr</span><span style="color: #0000ff;">></span>
                <span style="color: #0000ff;"><</span><span style="color: #800000;">td </span><span style="color: #ff0000;">colspan</span><span style="color: #0000ff;">="2"</span><span style="color: #0000ff;">></span>
                    <span style="color: #0000ff;"><</span><span style="color: #800000;">table </span><span style="color: #ff0000;">width</span><span style="color: #0000ff;">="100%"</span><span style="color: #ff0000;"> border</span><span style="color: #0000ff;">="0"</span><span style="color: #ff0000;"> cellspacing</span><span style="color: #0000ff;">="0"</span><span style="color: #ff0000;"> cellpadding</span><span style="color: #0000ff;">="0"</span><span style="color: #ff0000;"> style</span><span style="color: #0000ff;">="margin-bottom:3px;"</span><span style="color: #0000ff;">></span>
                        <span style="color: #0000ff;"><</span><span style="color: #800000;">tbody</span><span style="color: #0000ff;">></span>
                            <span style="color: #0000ff;"><</span><span style="color: #800000;">tr</span><span style="color: #0000ff;">></span> 
                                <span style="color: #0000ff;"><</span><span style="color: #800000;">td </span><span style="color: #ff0000;">width</span><span style="color: #0000ff;">="90"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="bline"</span><span style="color: #ff0000;"> height</span><span style="color: #0000ff;">="24"</span><span style="color: #0000ff;">></span><span style="color: #ff0000;"> </span>imgmm:<span style="color: #0000ff;"></</span><span style="color: #800000;">td</span><span style="color: #0000ff;">></span>
                                <span style="color: #0000ff;"><</span><span style="color: #800000;">td </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="bline"</span><span style="color: #0000ff;">></span>
                                    <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text"</span><span style="color: #ff0000;"> name</span><span style="color: #0000ff;">="typeimg"</span><span style="color: #ff0000;"> id</span><span style="color: #0000ff;">="imgmm"</span><span style="color: #ff0000;"> style</span><span style="color: #0000ff;">="width:300px"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="text"</span> <span style="color: #0000ff;">/></span> 
                                    <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="imgmm_bt"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="button"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="inputbut"</span><span style="color: #ff0000;"> value</span><span style="color: #0000ff;">="浏览..."</span><span style="color: #ff0000;"> onclick</span><span style="color: #0000ff;">="SelectImage('form1.imgmm','big')"</span> <span style="color: #0000ff;">/></span>
                                <span style="color: #0000ff;"></</span><span style="color: #800000;">td</span><span style="color: #0000ff;">></span>
                            <span style="color: #0000ff;"></</span><span style="color: #800000;">tr</span><span style="color: #0000ff;">></span>
                        <span style="color: #0000ff;"></</span><span style="color: #800000;">tbody</span><span style="color: #0000ff;">></span>
                    <span style="color: #0000ff;"></</span><span style="color: #800000;">table</span><span style="color: #0000ff;">></span>
                    <span style="color: #0000ff;"><</span><span style="color: #800000;">input </span><span style="color: #ff0000;">type</span><span style="color: #0000ff;">="hidden"</span><span style="color: #ff0000;"> name</span><span style="color: #0000ff;">="dede_addonfields"</span><span style="color: #ff0000;"> value</span><span style="color: #0000ff;">="imgmm,img"</span> <span style="color: #0000ff;">/></span>
                <span style="color: #0000ff;"></</span><span style="color: #800000;">td</span><span style="color: #0000ff;">></span>
            <span style="color: #0000ff;"></</span><span style="color: #800000;">tr</span><span style="color: #0000ff;">></span>

5단계: 열 측 채널 태그를 호출하므로 변경해야 합니다. /include/taglib/channel.lib.php 파일을 입력하고 78행을 찾아 다음 코드를 기본값으로 바꿉니다(typeimg 필드 추가). 쿼리)

    <span style="color: #0000ff;">if</span>(<span style="color: #800080;">$type</span>=='top'<span style="color: #000000;">)
    {
        </span><span style="color: #800080;">$sql</span> = "<span style="color: #000000;">SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg
          From `#@__arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, </span><span style="color: #800080;">$line</span> "<span style="color: #000000;">;
    }
    </span><span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span>(<span style="color: #800080;">$type</span>=='son'<span style="color: #000000;">)
    {
        </span><span style="color: #0000ff;">if</span>(<span style="color: #800080;">$typeid</span>==0) <span style="color: #0000ff;">return</span> ''<span style="color: #000000;">;
        </span><span style="color: #800080;">$sql</span> = "<span style="color: #000000;">SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,content,typeimg
          From `#@__arctype` WHERE reid='</span><span style="color: #800080;">$typeid</span>' And ishidden<>1 order by sortrank asc limit 0, <span style="color: #800080;">$line</span> "<span style="color: #000000;">;
    }
    </span><span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span>(<span style="color: #800080;">$type</span>=='self'<span style="color: #000000;">)
    {
        </span><span style="color: #0000ff;">if</span>(<span style="color: #800080;">$reid</span>==0) <span style="color: #0000ff;">return</span> ''<span style="color: #000000;">;
        </span><span style="color: #800080;">$sql</span> = "<span style="color: #000000;">SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,typeimg
            FROM `#@__arctype` WHERE reid='</span><span style="color: #800080;">$reid</span>' And ishidden<>1 order by sortrank asc limit 0, <span style="color: #800080;">$line</span> "<span style="color: #000000;">;
    }</span>

마지막 단계: 포그라운드에서 호출

        {dede:channel type='self' typeid='15' row='8' currentstyle="<li><a href='~typelink~' class='thisclass'>~typename~</a> </li>"<span style="color: #000000;">} 
        </span><li><a href='[field:typelink/]'>[field:typename/]</a> <img src='[field:typeimg/]' /></li><span style="color: #000000;"> 
        {</span>/dede:channel}

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.