首页 > 代码库 > dede标签

dede标签

μ¥μ¥??è??3??à?????3?μ??°£??éò?ó?£o
{dede:type typeid=‘1‘}
    <a href="http://www.mamicode.com/[field:typelink /]">[field:typename /]</a>
{/dede:type}

//获取顶级栏目名称
{dede:field name=‘typeid‘ function="GetTopTypename(@me)" /}

==========ê1ó?function="GetTopTypename Dèòa°?????μ?oˉêy ·?μ?common.func.php ???t?D=========================

//??è??¥??à?????
function GetTopTypename($id)
{
    global $dsql;
    $row = $dsql->GetOne("SELECT typename,topid FROM  `#@__arctype` WHERE id= $id");
    if ($row[‘topid‘] == ‘0‘)
    {
        return $row[‘typename‘];
    }
    else
    {
        $row1 = $dsql->GetOne("SELECT typename FROM  `#@__arctype` WHERE id= $row[topid]");
        return $row1[‘typename‘];
    }
}




{dede:field.video runphp=‘yes‘}
    if(@me == ‘‘ )
        @me = ‘dddddddddddddd‘;
    else
        @me = ‘oooooo‘;
{/dede:field.video}



// ?-?·?????úèY
{dede:arclist titlelen=‘60‘ infolen=‘160‘ row=‘8‘ addfields="video" channelid=""}

      <!-- ìí?óDòáDo? -->
        [field:global runphp=‘yes‘ name=autoindex]
          if (@me < 2) 
            @me = ‘<div class="item active">‘;
          else 
            @me = ‘<div class="item">‘;
        [/field:global] 


      <li><span>[field:pubdate function="MyDate(‘m-d‘,@me)"/]</span><a href="http://www.mamicode.com/[field:arcurl /]">[field:title /]  [field:litpic /]  [field:infos/] </a></li>

      {/dede:arclist}


//μ÷è?μ±?°×ó·?ààμ?à???
{dede:channel type = ‘son‘  row=‘8‘ currentstyle="<li ><a href=http://www.mamicode.com/‘~typelink~‘ class=‘li_hover‘ >~typename~ "} 
         <li><a href=http://www.mamicode.com/‘[field:typelink/]‘>[field:typename/]  
{/dede:channel} 


{dede:type}
    [field:typelink /]
    [field:typename/]
    [field:description /]
{/dede:type}

//??è?
[field:description function=‘cn_substr(@me,120)‘ /]

//域名
{dede:global.cfg_basehost/}

//í???csc?ùê??·??
{dede:global.cfg_templets_skin/}/




//??è??¥??à???μ???3?
{dede:channelartlist typeid=‘top‘}
            <li class="dropdown">
                <a href=http://www.mamicode.com/‘{dede:field name=‘typeurl‘/}‘ [field:rel/]  class="dropdown-toggle" data-toggle="dropdown">
                    {dede:field name=‘typename‘/} <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    {dede:channel row="10"  }
                      <li><a  href=http://www.mamicode.com/‘[field:typeurl/]‘ [field:rel/]>[field:typename/]
                    {/dede:channel}
                </ul>
            </li>
            {/dede:channelartlist}


//·?ò3±ê??μ÷ó?
{dede:list pagesize=‘6‘ infolen=‘90‘}                        
                        <li>
                            <a href="http://www.mamicode.com/[field:arcurl/]">
                                <img src="http://www.mamicode.com/[field:litpic/]" />
                                <span>[field:title/]</span>
                                <p>[field:infos/]</p>
                              [field:pubdate function=MyDate(‘y-m-d‘,@me)/]
                            </a>
                        </li>
{/dede:list} 



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



//面包屑
{dede:field name=‘position‘/} 




//??è?à???????í?
{dede:field.typeimg /}



//??è?ê×ò3??è?à????úèYμ?±ê??
{dede:sql sql="SELECT typename, content, typedir FROM dede_arctype where id=9"}
    [field:typename/]
    
    [field:content function=‘cn_substr(@me,300)‘/]...

{/dede:sql}

//ó??éá′?ó


<!-- 轮播 -->
    {dede:php}
        $sql = "SELECT  a.`litpic`, l.redirecturl  FROM  `#@__archives` AS a INNER JOIN  `#@__lunbo` l ON  a.id = l.aid WHERE a.`typeid` = 6  ";
        $dsql->SetQuery($sql);
        $dsql->Execute();
        $i = 1;
        while ( $row = $dsql->GetArray() )
        {
            if ( $i > 1)
            {
              if( $row[‘redirecturl‘]  == ‘‘)
                $gourl = ‘javascript:;‘;
              else
                $gourl = $row[‘redirecturl‘];

              echo ‘<div class="slide slide--‘.$i.‘">‘;
                echo ‘<a href="http://www.mamicode.com/‘.$gourl.‘" target="_blank" ><img src="http://www.mamicode.com/‘.$row[‘litpic‘].‘"></a>‘;
              echo ‘</div>‘;
              
            }
            $i ++; 
        }

    {/dede:php}


//栏目内容
{dede:field.content/}


//?-?·′?óD×óààμ?à???
 {dede:channelartlist typeid=‘top‘ cacheid=‘channelsonlist‘ }
      <li>
        <a href=http://www.mamicode.com/‘{dede:field name=‘typeurl‘/}‘ [field:rel/] >
          {dede:field name=‘typename‘/}
        </a>
        <ul class="nav-secend">

          {dede:channel row="10"  }
          <li>
            <a href=http://www.mamicode.com/‘[field:typeurl/]‘ [field:rel/] >
              [field:typename/]
            </a>
          </li>
          {/dede:channel}

        </ul>
      </li>

<!-- 跳到当前分类下最新的文章中 -->
    <script language="javascript" type="text/javascript">
    {dede:channel type = ‘son‘ row=‘1‘}
      var gourl =  ‘[field:typelink/]‘;
    {/dede:channel}
        window.location.href =http://www.mamicode.com/ gourl;
    </script>


{/dede:channelartlist}

//获取栏目内容图片
{dede:php}
        $sql = "SELECT * FROM `dede_arctype` WHERE id=‘6‘ AND ishidden=‘0‘  ";
        $row = $dsql->GetOne($sql);
        $typelink = GetOneTypeUrlA($row);
        //正则匹配出合作的的文章内容的图片,并循环出来
        $pattern="/<[img|IMG].*?src=http://www.mamicode.com/[/‘|/"](.*?(?:[\.gif|\.jpg|\.png]))[\‘|\"].*?[\/]?>/";
        preg_match_all($pattern,$row[‘content‘],$match);
        
       $str = ‘‘;
       foreach( $match[1] as $k => $v )
       {
          $str .=<<<str
            <div class="col-lg-3 col-md-4 col-xs-6 text-center wow flipInY" data-waw-delay="1s">
              <a href="http://www.mamicode.com/{$typelink}">
                <img src="http://www.mamicode.com/{$v}" class="img-responsive">
              </a>
            </div>
str;
          if( $k == 7 ) break;
       }

       echo $str;

    {/dede:php}

---------------列表----------------------

<title>{dede:field.title/}_{dede:global.cfg_webname/}</title>
<meta name="keywords" content="{dede:field name=‘keywords‘/}" />
<meta name="description" content="{dede:field name=‘description‘ function=‘html2text(@me)‘/}" />

<script type="text/javascript">if(window.location.toString().indexOf(‘pref=padindex‘) != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="http://www.mamicode.com/{dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>



href="{dede:global.cfg_templets_skin/}/css/
src=http://www.mamicode.com/"{dede:global.cfg_templets_skin/}/images/
src="{dede:global.cfg_templets_skin/}/js/
url({dede:global.cfg_templets_skin/}/images/

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


href=http://www.mamicode.com/"assets/style
src="assets/js/
src=http://www.mamicode.com/"assets/images/




================= 首页title======================

<title>{dede:global.cfg_webname/}</title>
<meta name="description" content="{dede:global.cfg_description/}" />
<meta name="keywords" content="{dede:global.cfg_keywords/}" />

================= 详情页======================
<title>{dede:field.title/}_{dede:global.cfg_webname/}</title>
<meta name="keywords" content="{dede:field.keywords/}" />
<meta name="description" content="{dede:field.description function=‘html2text(@me)‘/}" />
<link href="http://www.mamicode.com/{dede:global.cfg_templets_skin/}/style/dedecms.css" rel="stylesheet" media="screen" type="text/css" />

<meta http-equiv="mobile-agent" content="format=xhtml;url={dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}">
<script type="text/javascript">if(window.location.toString().indexOf(‘pref=padindex‘) != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="http://www.mamicode.com/{dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>


{dede:field.title/} 
时间:</small>{dede:field.pubdate function="MyDate(‘Y-m-d H:i‘,@me)"/}
<small>来源:</small>{dede:field.source/} 
作者:</small>{dede:field.writer/} 
{/dede:field.description}
{dede:field.body/}
(责任编辑:{dede:adminname/})

<li>{dede:prenext get=‘pre‘/}</li>
<li>{dede:prenext get=‘next‘/}</li

 

dede标签