织梦内容关键词和标签如何调取,代码是什么

日期:2020-05-28 10:37 来源:原创 作者:小霍 点击:

第一:内容需要增加以下代码

  <div class="tags"><span>标签:</span>{dede:tag row='10' sort='rand'} <a href='[field:link/]'>[field:tag/]</a> {/dede:tag}</div>

样式;    <style>.tags {
    overflow: hidden;
    margin-bottom: 20px;
        margin-top: 20px;
}.tags span {
    float: left;
    display: block;
    line-height: 40px;
    font-weight:bold;
}.tags a {
    border-radius: 4px;
    -webkit-border-radius: 4px;
    display: inline-block;
    line-height: 28px;
    padding: 0 6px;
    margin: 5px;
    background: #fff;
    border: 1px solid #dadada;
}</style>

需要在网站根目录增加tag.php 二次更新:

require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once (DEDEINC . "/arc.taglist.class.php");
$PageNo = 1;
if(isset($_SERVER['QUERY_STRING']))
{
    $tag = trim($_SERVER['QUERY_STRING']);
    $tags = explode('/', $tag);
    if(isset($tags[1])) $tag = $tags[1];
    if(isset($tags[2])) $PageNo = intval($tags[2]);
}
else
{$tag = '';}
$tag = FilterSearch(urldecode($tag));
if($tag != addslashes($tag)) $tag = '';
if($tag == '') $dlist = new TagList($tag, 'list.htm');
else $dlist = new TagList($tag, 'list.htm');
$dlist->Display();
exit();


功能实现

Copyright © 2019.Company name All rights reserved. 冀ICP备14010059号-4 网站地图