dedecms

breadcrumb

.breadcrumb > li {
    display: inline-block;
}
.breadcrumb > li + li:before {
    padding: 0 5px;
    color: #ccc;
    content: "/\00a0";
}
.breadcrumb > .active {
    color: #777;
}

301跳轉(zhuǎn)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^alksc.com$ 
RewriteRule ^(.*)$ http://www.alksc.com/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/index\.html$
RewriteRule ^(.*)$ / [R=301,L]
</IfModule>

手機網(wǎng)站跳轉(zhuǎn)

<script type="text/javascript">
var browser = {
    versions : function() {
        var u = navigator.userAgent, app = navigator.appVersion;
        return {//移動終端瀏覽器版本信息
            mobile : (!!u.match(/AppleWebKit.*Mobile/) || !!u.match(/Windows Phone/) || !!u.match(/Android/) || !!u.match(/MQQBrowser/)) && !u.match(/iPad/)
            //是否為移動終端
        };
    }()
}
if(browser.versions.mobile){
    window.location.href="/mobile/";
}
</script>

引入swiper輪播

<link  rel="stylesheet">
<script src="https://cdn.bootcss.com/Swiper/4.3.5/js/swiper.min.js"></script>
<div class="swiper-container">
    <div class="swiper-wrapper">
        {dede:channel typeid='1' type='son' row='3'}<div class="swiper-slide"><img src="[field:typeimg/]" /></div> {/dede:channel}
    </div>
    <div class="swiper-pagination"></div>
</div>
<script>
var mySwiper = new Swiper('.swiper-container', {
    autoplay: {
        delay: 2000,
        stopOnLastSlide: false,
    disableOnInteraction: true,
    },
    pagination: {
        el: '.swiper-pagination',
        clickable :true,
    },
})
</script>
.swiper-slide{
    height:auto !important;
}
.swiper-slide img{
    width:100%;
    height:auto;
}

基礎(chǔ)設(shè)置

alter table `dede_arctype` change `typename` `typename` char(60);
alter table `dede_archives` change `title` `title` varchar(200);
alter table `dede_archives` change `description` `description` varchar(1000);
alter table `dede_arctype` change `description` `description` char(250);
alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';
<title>{dede:global.cfg_webname/}</title>
<meta name="keywords" content="{dede:global.cfg_keywords/}" />
<meta name="description" content="{dede:global.cfg_description/}" />
<title>{dede:field.title/}_{dede:global.cfg_gsmz/}</title>
<meta name="keywords" content="{dede:field name='keywords'/}" />
<meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" />
<title>{dede:field.seotitle /}_{dede:global.cfg_gsmz/}</title>
<meta name="keywords" content="{dede:field name='keywords'/}" />
<meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" />
<title>{dede:field.seotitle /}_{dede:pagelist listsize="0" listitem="pageno" function="html2text(@me)" runphp="yes"}@me="第".str_replace(' ','',@me)."頁";{/dede:pagelist}_{dede:global.cfg_gsmz/}</title>
<meta name="keywords" content="{dede:field name='keywords'/}" />
<meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" />

根目錄

{dede:global.cfg_templets_skin/}/

引入foot文件

{dede:include filename='foot.htm'/}

引入head文件

{dede:include filename='head.htm'/}

引用后臺基本參數(shù)

{dede:global.poweredby/}

調(diào)用帶logo的友情鏈接

{dede:sql sql="Select * From youbook_flink where logo = '' order by id desc"}
<a target="_blank" href="[field:url/]" title="[field:webname/]" class="a1">[field:webname/]</a>
{/dede:sql}

文章描述

[field:description function="cn_substr(@me,280)"/]
{dede:field.description function="cn_substr(@me,280)"/}

日期

  1. 自定義日期
    [field:pubdate function='strftime("%m-%d","@me")' /]
  2. 常用日期
    [field:pubdate function="GetDateMK(@me)"/]
    {dede:field.pubdate function="GetDateMK(@me)"/}

翻頁精簡版

{dede:pagelist listitem="pre,next,pageno listsize="5"/}

翻頁完整版

//{dede:pagelist listitem="info,index,end,pre,next,pageno,option listsize="5"/}
[field:description function="cn_substr(@me,280)"/]
{dede:field.description function="cn_substr(@me,280)"/}

調(diào)用指定欄目鏈接

{dede:type typeid='1'}[field:typelink/]{/dede:type}

調(diào)用指定欄目名稱

{dede:type typeid='1'}[field:typename/]{/dede:type}

調(diào)用指定id欄目內(nèi)容

{dede:sql sql='Select content from sh_arctype where id=1'}[field:content function="cn_substr('@me',1200)" /]{/dede:sql}

翻頁

  1. 上一篇:
    {dede:prenext get='pre'/}
  2. 下一篇:
    {dede:prenext get='next'/}

面包屑

{dede:field.position/}

自增autoindex

arclist 標簽下使用 [field:global.autoindex/] 默認從1開始
channel 標簽下使用 [field:global.autoindex/] 默認從0開始
channelartlist 標簽下使用 {dede:global.itemindex/} 默認從1開始

arclist 從0開始[field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global]
channel 從1開始[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global][field:typename/]
channelartlist 從0開始{dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global}

表單的alert

echo "<script>alert('提交成功!'); history.go(-1)</script>";

統(tǒng)計該欄目下有多少新聞標題

{dede:type typeid='9'}[field:id function="dynamic_num(@me)" /]{/dede:type}條

列表頁調(diào)用文章內(nèi)容

之后就可以在列表頁的文章列表中調(diào)用文章內(nèi)容了,代碼如下:先要在內(nèi)容模型把body填寫到內(nèi)容附加字段里

{dede:list pagesize='18' addfields='body'} 
  [field:body/]
{/dede:list}

調(diào)用內(nèi)容到首頁

  1. 首頁調(diào)用單頁內(nèi)容(例如調(diào)用公司簡介、聯(lián)系我們)
    如公司簡介、聯(lián)系我們這樣的單頁面,調(diào)用其中全部內(nèi)容可以使用代碼代碼,其中id可以控制調(diào)用指定id的欄目。
{dede:sql sql='Select content from dede_arctype where id=2'}
   [field:content/]
{/dede:sql}
  1. 調(diào)用單頁內(nèi)容(和上面代碼差不多,只是更換了中間代碼)
    第一種方法可以調(diào)用單頁所有內(nèi)容,包括單頁內(nèi)容的圖片、格式等,全部調(diào)用。但如果我們只想調(diào)用單頁的部分文字,可以用下面代碼:
{dede:sql sql='Select content from dede_arctype where id=2'  }
[field:content function='cn_substr(html2text(@me),550)'/]...
{/dede:sql}
  1. 在首頁調(diào)用文章內(nèi)容
    上面兩種方法是在首頁調(diào)用單頁欄目的內(nèi)容,如果我們想在首頁調(diào)用文章內(nèi)容,就需要用下面代碼,其中typeid=2是調(diào)用id=2的欄目的最新文章。
{dede:sql sql="SELECT aid,typeid,body FROM `#@__addonarticle` where typeid=2 ORDER BY `aid` DESC LIMIT 0 , 1"}
[field:body /]
{/dede:sql}

搜索頁樣式修改

/include/arc.searchview.class.php

獲取當前文章id

{dede:sql sql='Select * from baoan_addonarticle where aid=~aid~'}[field:aid/]{/dede:sql}

當前文章欄目高亮

{dede:arclist typeid='6' row='52' titlelen='250'}
      <li><a href="[field:arcurl/]" id="a_[field:id/]">[field:title/]</a></li>
{/dede:arclist}
<input type="hidden" value="{dede:sql sql='Select * from baoan_addonarticle where aid=~aid~'}[field:aid/]{/dede:sql}" id="aaid"/> //增加一個隱藏的input來獲取當前文章的id
<input type="hidden" value="{dede:sql sql='Select * from jietong_arctype where id=~id~'}[field:id/]{/dede:sql}" id="aaid"/>//增加一個隱藏的input來獲取當前欄目的id
<input type="hidden" value="{dede:field.typeid/}" id="aaid"/>//增加一個隱藏的input來獲取當前文章對應(yīng)的欄目的id
$(document).ready(function(){
    var ccid=$("#aaid").val();
    $("#a_"+ccid).addClass("a");
});

修改友情鏈接

打開/include/taglib搜索{dede:flink linktype='1' typeid='4' row='999'}[field:link /]{/dede:flink}
typeid='4' 表示類型
linktype='1' 表示位置 首頁

{dede:flink linktype='1' typeid='4' row='999'}[field:link /]{/dede:flink}

調(diào)用特定id文章的描述

{dede:sql sql="SELECT id,typeid,description FROM `azqy_archives` where id=6"}
[field:description /]
{/dede:sql}

調(diào)用指定id文章

{dede:arclist typeid='2' idlist='7'}[field:title/]{/dede:arclist}

獲取頂級欄目名

  1. include/common.func.php的最下方加入:
//獲取頂級欄目名
function GetTopTypename($id)
{
global $dsql;
$row = $dsql->GetOne("SELECT typename,topid FROM geer_arctype WHERE id= $id");
if ($row['topid'] == '0')
{
return $row['typename'];
}
else
{
$row1 = $dsql->GetOne("SELECT typename FROM geer_arctype WHERE id= $row[topid]");
return $row1['typename'];
}
}
  1. 調(diào)用語句:{dede:field name='typeid' function='GetTopTypename(@me)' /}

信息發(fā)布員自行修改密碼

/admin/sys_admin_user_edit.php第23行CheckPurview('sys_User');改成CheckPurview('sys_MdPwd');

<!--帶0的arclist的自動生成數(shù)字-->
[field:global name=autoindex runphp="yes"](@me<10)?@me="0@me":@me="10";[/field:global]

修改數(shù)據(jù)表以后無法刪除文章

其中ddth是修改以后的數(shù)據(jù)表的名稱

update ddth_channeltype set maintable='ddth_archives'

搜索

<form name="formsearch" action="/plus/search.php" method="post" onsubmit="return validator()">
    <input name="q" type="text" id="search-keyword" value="請輸入關(guān)鍵詞..." onfocus="if(this.value=='請輸入關(guān)鍵詞...'){this.value='';}" onblur="if(this.value==''){this.value='請輸入關(guān)鍵詞...';}" />
    <input value="搜 索" type="submit" />                                    
</form> 
function validator(){
    if($('#search-keyword').val()=="請輸入關(guān)鍵詞..."||$('#search-keyword').val()==""||$.trim($('#search-keyword').val()).length==0){
        alert("請輸入關(guān)鍵詞!");
        $('#search-keyword').focus();
        return false;
    }
}

調(diào)用頂級欄目以及子欄目

<li class="nav_lev1"> <a href="/" {dede:field name=typeid runphp="yes"}(@me=="")? @me=" class='menu1 active' ":@me="";{/dede:field}>網(wǎng)站首頁 </a> </li>
{dede:channelartlist typeid='top' currentstyle='active' row='6'}
<li class="nav_lev1">
    <a href="{dede:field name='typeurl'/}" class="menu1 {dede:field.currentstyle/}">
    {dede:field name='typename'/}
    {dede:field name=typeid runphp="yes"}
        global $dsql;
        $sql = "SELECT id From `dede_arctype` WHERE reid='@me' And ishidden<>1 order by sortrank asc limit 0, 100 ";
        $row = $dsql->GetOne($sql);
        @me=is_array($row)?'<i class="fa fa-caret-down"></i>':'';
    {/dede:field}
    </a>
    <ul {dede:field name=typeid runphp="yes"} global $dsql;
        $sql = "SELECT id From `#@__arctype` WHERE reid='@me' And ishidden<>1 order by sortrank asc limit 0, 100 ";
        $row = $dsql->GetOne($sql);
        @me=is_array($row)?'class="drop-down sub-menu2"':'style="display:none"';
    {/dede:field}>
        {dede:channel type='son' noself='yes'}
        <li class="Lev2"> <a href="[field:typeurl/]" class="menu2">[field:typename/]</a> </li>
        {/dede:channel}
    </ul>
</li>
{/dede:channelartlist}

首頁自定義字段

{dede:myad name='廣告位標識 '/}

調(diào)用指定欄目ID的欄目名稱

{dede:type typeid='2'}<a href="[field:typelink/]">[field:typename/]</a>{/dede:type}

調(diào)用指定欄目及其子欄目兩種方法

{dede:channelartlist typeid='2,3' row='6'}
<li><a class="hide" href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a>
    <ul>
            {dede:channel type='son' noself='yes' }
             <li><a href='[field:typelink/]'>[field:typename/]</a></li>
             {/dede:channel}
    </ul>
</li>
{/dede:channelartlist}
<li>{dede:type typeid='5'}<a href='[field:typelink/]'>[field:typename/]</a>{/dede:type}
   <ul>
            {dede:channel type='son' typeid='5' noself='yes' }
                <li><a href='[field:typelink/]'>[field:typename/]</a></li>
            {/dede:channel}
    </ul>
</li>

dede:arclist下的附加字段調(diào)用

{dede:arclist titlelen='60' row='7' typeid='欄目ID' channelid='附加表的ID' addfields='附加字段'}
    <a href="[field:附加字段/]">[field:title/]</a>
{/dede:arclist}

首頁調(diào)用指定ID文章內(nèi)容

{dede:arclist titlelen='60' row='1' typeid='欄目ID' channelid='附加表的ID' addfields='附加字段' idlist='文章ID'}
    [field:body function='cn_substr("@me",400)' /]
 {/dede:arclist}

GetInnerText

織夢DedeCMS在更新列表頁html時提示:Fatal error: Call to a member function GetInnerText() on a non-object in \include\taglib\channel\img.lib.php on line 42
往往這個錯誤提示會在更新自定義模型的欄目列表頁html時出現(xiàn),解決的辦法:

  1. 找到并打開/include/taglib/channel/img.lib.php文件,在里面找到如下代碼:
    $innerTmp = $arcTag->GetInnerText();
  2. 將其替換為如下代碼:
    $innerTmp = ($arcTag=="") ? trim($arcTag) : trim($arcTag->GetInnerText());
    這樣就可以解決這個問題了。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容