Home php教程 php手册 dedecms中常见问题修改方法总结

dedecms中常见问题修改方法总结

Jun 13, 2016 pm 12:32 PM
dedecms Revise exist common problem Summarize newbie method yes have formal edition of

新手常见问题,此贴是早些时候我发的,在3.1正式版中.有些问题已得到修正,不过仍可作为修改或学习参考
请大家花点耐心看完这个吧,这些问题很多人都有碰到.何必要不停的发贴子问呢?
另外,看完这个请去你自己的后台看完模板标记参考!!特别是arclist这个标记的参数说明!!
多思考一下问题,多试验一下标记,,学到就是自己的,学不到,谁也帮不到你!!
补充一点..很多标记都可以参考系统默认的模板和模板区的一些好模板,多看标记体会每个标记的用法,
下文如果有您的贴子..感谢您对DEDE的匏礁冻?.
3.1lit最新版当一级栏目为最终列表栏目时,使列表显示其下级栏目的文章的修改
include/inc_arclist_view.php
80行:
$addSql .= " And (typeid='".$this->TypeID."' or typeid2='".$this->TypeID."') ";
更改为:
//增加的,用来解决上级列表调用不出下级列表的问题
    $ssid = TypeGetSunID($this->TypeID,$this->dsql);
    $ssid2 = str_replace('typeid','typeid2',$ssid);
    //结束增加的
    $addSql .= " And (typeid='".$this->TypeID."' or ".$ssid." or typeid2='".$this->TypeID."' or ".$ssid2.") ";//本句也已修改
上面这部分用来解决分页问题
include/inc/inc_fun_SpGetArcList.php
70行开始:
if($ridnum>1){
    $tpsql = "";
    for($i=0;$i        if($tpsql=="") $tpsql .= " And (".TypeGetSunID($reids[$i],$dsql,'arc');
        else $tpsql .= " Or ".TypeGetSunID($reids[$i],$dsql,'arc');
    }
    $tpsql .= ") ";
    $orwhere .= $tpsql;
    unset($tpsql);
    }
    else{
    $orwhere .= " And ".TypeGetSunID($typeid,$dsql,'arc');
    }
更改为:
if($ridnum>1){
    $tpsql = "";
    for($i=0;$i        if($tpsql=="") {
        //开始修改文章第二栏目调用问题
        $ssid = TypeGetSunID($reids[$i],$dsql,'arc');
        $ssid2 = str_replace('typeid','typeid2',$ssid);
        $tpsql .= " And (".$ssid." or ".$ssid2;}
        else {
        $tpsql .= " Or ".TypeGetSunID($reids[$i],$dsql,'arc');
        $tpsql .= str_replace('typeid','typeid2',$tpsql);}
    }
    $tpsql .= ") ";
    $orwhere .= $tpsql;
    unset($tpsql);
    }
    else{
    $ssid = TypeGetSunID($typeid,$dsql,'arc');
    $ssid2 = str_replace('typeid','typeid2',$ssid);
    $orwhere .= " And (".$ssid." or ".$ssid2.") ";//结束修改文章第二栏目调用问题
    }
此部分用来解决调用下级栏目文章列表问题
替换的代码我写的很粗糙,可以暂时先用着,等官方的解决方案出来后再替换
在 include/inc_arclist_view.php还要改一处:
//获得一个单列的文档列表

    //类别ID的条件
    $orwhere .= " And (dede_archives.typeid='".$this->TypeID."' or dede_archives.typeid2='".$this->TypeID."') ";
改为:
    //类别ID的条件
      $ssid = TypeGetSunID($this->TypeID,$this->dsql);
    $orwhere .= " And (dede_archives.typeid='".$this->TypeID."' or ".$ssid." or dede_archives.typeid2='".$this->TypeID."') ";
否则有页面没有列表内容,因为80行是Select count(*).....
关于那个栏目路径有个{cmspath}
首先说一下{cmspath}的意思,,打开后台"系统配置参数"可以看到第二项,DedeCms安装目录: 
这个就是{cmspath}所解析出来的路径,
如果beta2升级到lit,需要手工修改栏目属性,把{cmspath}去除.或者你运行setup升级完之后用lit的所有文件
替换掉之前的B2的所有文件,这样{cmspath}就可以正常解析成你的网站路径
如果你不用{cmspath}这个参数,.可以照下面的修改
执行SQL: update dede_arctype set typedir=replace(typeidr,'{cmspath}','');
以去掉数据库的里 {cmspath}
然后修改文件 catalog_add.php 找到 $true_typedir = str_replace("{cmspath}",$cfg_cmspath,$typedir);
改成
$true_typedir = str_replace("",$cfg_cmspath,$typedir);
就行
[field:description /]这个标签如何限制字数?
[field:description function='cn_substr(@me,80)'/]
dede 里的所有标记都支持这样使用函数的
关于3.1版友情链接添加后在首页没有显示的问题
引起这个的主要原因是BLT在编写的时候把表 dede_flink的ischeck的值弄反了造成的.
在3.01里..ischeck=1表示首页链接..2表示内页链接,但3.1正好相反,
给一个最简直的改法就是打开inc_fun_SpGetFriendLink.php
找到第13行..
CODE:
$wsql = " where ischeck=1 "; 
[Copy to clipboard]
将1改为2就行了.
11.11更新过后,取消了inc_fun_SpGetFriendLink.php这个文件的调用.
所以只须要打开inc_arcpart_view.php
在410行附近
CODE:
    $wsql = " where ischeck=1 ";
    if($type=="p_w_picpath") $wsql .= " And logo'' ";
    else if($type=="text") $wsql .= " And logo='' ";
    else $wsql .= "";
[Copy to clipboard]
同样将where ischeck=1改为2就可以
3.1LIT版广告名称修改后无效的解决办法
http://bbs.dedecms.com/read.php?tid=7135
看4楼的回贴.
dede新版如何去掉列表的文章摘要
删除[field:info/]
关于后台登陆验证码样式的修改
http://bbs.dedecms.com/read.php?tid=6244
当文章描述中出现的英文长度大于table的宽度时,会搞的很难看
[field:textlink /]
改为
[field:title function='cn_substr(@me,30)' /]
新建频道模型教程
http://bbs.dedecms.com/read.php?tid=5972
dedecms实现列表页双样式


{dede:list type='full'}



{/dede:list}
[field:typelink /] [field:textlink /]点击:[field:click /]([field:stime /])

我想实现一个功能,就是在文章列表中(模板list_article)如果文章有缩略图就显示缩略图,没有的话则直接显示文章列表而不显示“没有缩略图”的图片。
dedecms的扩展是用function形式的,因为加入if这种结构太占用资源,如果你有必要,你可以这样:
[field:picname function="GetMyPic('@me')"/]
在 inc_functions.php 里定义一个函数
function GetMyPic($img)
{
if($img=="") return "";
else return "dedecms中常见问题修改方法总结";
}
这样来处理
这种做法可能会有点不便,但好处是既达到扩展目的,又不会占用太大资源,又不影响模板结构,实现真正的模板与代码分离
点击图片进入下一页 
打开include/inc_archives_view.php
大概在444行左右,找到
$this->Fields[$this->SplitPageField]=$this->Fields[$this->SplitPageField];
注释掉,改为
$this->Fields[$this->SplitPageField]=$this->ClickPicNext($this->Fields[$this->SplitPageField]);
然后,最后加上函数,注意在最后一个括号里面!
//把图片替换成链接
//----------------------------
function ClickPicNext(&$body)
{
if($this->NowPage!=$this->TotalPage){
  $lPage=$this->NowPage+1;
  $body=preg_replace("/)/isU","NameFirst."_".$lPage.".".$this->ShortName."'>"."\${0}"."",$body);
  //$body="NameFirst."_".$lPage.".".$this->ShortName."'>".$body." ";
}else{
  if($this->GetNext()){
    $body=preg_replace("/)/isU","GetNext()."'>"."\${0}"."",$body);
    //$body="GetNext()."'>".$body." ";   
  }
}
  return $body;
}
自动地把文章中的图片替换为下一页的链接,如果是最后一页,则为下一篇!
注意:先要按下面的改法,把上一篇下一篇分开才行!
[dede3.1][改法]上一篇下一篇分开调用,且限定文章所在栏目内而不是现在的全站。
http://bbs.dedecms.com/read.php?tid=5051 
在文章列表中,有的标题被截断了,用什么样的代码可以让鼠标在上面的时候可以显示完整的文件名?
{dede:arclist row=16 orderby=pubdate col=1 typeid=3}
  • · [field:title function="cn_substr('@me',30)" /]

  • {/dede:arclist}
    怎么样在文章名前面显示所属的文章栏目?
    {dede:arclist row=10 orderby=pubdate}
    ·[field:typelink/] [field:textlink/]

    {/dede:arclist}
    生成的文章文件名能不能增加MD5加密
    自己改一下,这种属于典型的无聊需求吧
    include/inc_channel_unit_functions.php
    .
    [field:writer /]怎么没有用
    lit版inc_arcpart_view.php没有读取附加表
    修改include\inc\inc_fun_SpGetArcList.php第120行,在后面加 arc.writer,
    当然你也可以加入你还想引入的附加表内容如:
    arc.writer,arc.source,arc.shorttitle,
    新安装的DEDECMS3.0.1,第一次登陆就说我密码错误!
    你要查一下是否有 dede_admin 这个表,如果有,看看有没有数据,
    如果用户名和密码没有不允许的符号的话,
    一般是服务器可能能无法完成安装的SQL导入才可能会提示用户名不存在
    手工加个用户就OK了.
    也可以在数据库中删除表dede_admin,然后重新安装即可
    关于listpage分页在生成会有表格的修改 
    搜索 
    //获取静态的分页列表
    在下面的几行可以看到分页的一些东东
    关于栏目多风格和系统底层模版的问题 
    用arclist
    {dede:arclist
    typeid='' row='' col='' titlelen='' 
    infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword=''}
    自定义样式模板(InnerText)   //这里定义你显示的样式..不要修改底层模板了..免得你自己麻烦.
    {/dede:arclist}
    另外栏目的模板可以不使用系统默认的{style}/list_article.htm
    你可以手工指定栏目的封面模板或是列表模板嘛..列如:{style}/list_class1.htm
    {style}/list_class2.htm
    等.这样就可以多风格了嘛.
    用dedecms做小说站的思路 
    1、新建两个模型
    book模型和章节模型
    2、重新写档案发布程序,关键把两个模型关联起来,而现在提供内容模型的cmsware 和dede都是办不到的,而dede自建频道提供的档案发布程序项可以很好的利用。重新些这四个文件(两个界面和两个提交后处理的程序)即可。
    3、如果要做成起点中文网哪种模式,那就要在member目录下写关于投稿的程序,以及在plus里面写业务模式如计费、计点等功能的程序。
    其实, dede只是一个内容发布的框架,提供的后台工具只针对管理员而已,用户完全可以自我定制各种模型,不过要对dede熟悉一点而已。
    能写程序的不妨一试。
    为什么我的自定义标记总是被当做文本来输出
    标记里要加上 ismake='yes' 属性
    对图片SEO的一些思考,
    dedecms中常见问题修改方法总结
    参考arclist标记的说明,,
    dede编辑器的问题..从WORD复制进去的错误
    复制后安 工具栏 上那个右下角有黄色T的粘贴按钮~~~移上去有提示的,无格式粘贴 
    标签的定义放在什么地方的
    凡是include里的文件,有什么 ***view.php 都是控制视图的
    关于自动分页的问题
    自动分页的大小为只能在2-5之前
    3 就是每个分页为3K的意思。
    这个跟动易的不一样,动易的是字节,所以你可以写2000 或则 3000 DEDE的是K 所以,你只能写 2或则3,我的错误在,我写成2000K!汗一个,
    这在DEDE里的意思是,一个分页允许到2M !自然不成功
    关于分页标题
    内容部分如下格式即可:
    分页标题1#e#
    第1页内容
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    How to change the personal name in the group on DingTalk_How to modify the personal name in the group on DingTalk How to change the personal name in the group on DingTalk_How to modify the personal name in the group on DingTalk Mar 29, 2024 pm 08:41 PM

    1. First open DingTalk. 2. Open the group chat and click the three dots in the upper right corner. 3. Find my nickname in this group. 4. Click to enter to modify and save.

    How to write a novel in the Tomato Free Novel app. Share the tutorial on how to write a novel in Tomato Novel. How to write a novel in the Tomato Free Novel app. Share the tutorial on how to write a novel in Tomato Novel. Mar 28, 2024 pm 12:50 PM

    Tomato Novel is a very popular novel reading software. We often have new novels and comics to read in Tomato Novel. Every novel and comic is very interesting. Many friends also want to write novels. Earn pocket money and edit the content of the novel you want to write into text. So how do we write the novel in it? My friends don’t know, so let’s go to this site together. Let’s take some time to look at an introduction to how to write a novel. Share the Tomato novel tutorial on how to write a novel. 1. First open the Tomato free novel app on your mobile phone and click on Personal Center - Writer Center. 2. Jump to the Tomato Writer Assistant page - click on Create a new book at the end of the novel.

    How to recover deleted contacts on WeChat (simple tutorial tells you how to recover deleted contacts) How to recover deleted contacts on WeChat (simple tutorial tells you how to recover deleted contacts) May 01, 2024 pm 12:01 PM

    Unfortunately, people often delete certain contacts accidentally for some reasons. WeChat is a widely used social software. To help users solve this problem, this article will introduce how to retrieve deleted contacts in a simple way. 1. Understand the WeChat contact deletion mechanism. This provides us with the possibility to retrieve deleted contacts. The contact deletion mechanism in WeChat removes them from the address book, but does not delete them completely. 2. Use WeChat’s built-in “Contact Book Recovery” function. WeChat provides “Contact Book Recovery” to save time and energy. Users can quickly retrieve previously deleted contacts through this function. 3. Enter the WeChat settings page and click the lower right corner, open the WeChat application "Me" and click the settings icon in the upper right corner to enter the settings page.

    Can Douyin Blue V change its name? What are the steps to change the name of corporate Douyin Blue V account? Can Douyin Blue V change its name? What are the steps to change the name of corporate Douyin Blue V account? Mar 22, 2024 pm 12:51 PM

    Douyin Blue V certification is the official certification of a company or brand on the Douyin platform, which helps enhance brand image and credibility. With the adjustment of corporate development strategy or the update of brand image, the company may want to change the name of Douyin Blue V certification. So, can Douyin Blue V change its name? The answer is yes. This article will introduce in detail the steps to modify the name of the enterprise Douyin Blue V account. 1. Can Douyin Blue V change its name? You can change the name of Douyin Blue V account. According to Douyin’s official regulations, corporate Blue V certified accounts can apply to change their account names after meeting certain conditions. Generally speaking, enterprises need to provide relevant supporting materials, such as business licenses, organization code certificates, etc., to prove the legality and necessity of changing the name. 2. What are the steps to modify the name of corporate Douyin Blue V account?

    The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs) The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs) May 04, 2024 pm 06:01 PM

    Mobile games have become an integral part of people's lives with the development of technology. It has attracted the attention of many players with its cute dragon egg image and interesting hatching process, and one of the games that has attracted much attention is the mobile version of Dragon Egg. To help players better cultivate and grow their own dragons in the game, this article will introduce to you how to hatch dragon eggs in the mobile version. 1. Choose the appropriate type of dragon egg. Players need to carefully choose the type of dragon egg that they like and suit themselves, based on the different types of dragon egg attributes and abilities provided in the game. 2. Upgrade the level of the incubation machine. Players need to improve the level of the incubation machine by completing tasks and collecting props. The level of the incubation machine determines the hatching speed and hatching success rate. 3. Collect the resources required for hatching. Players need to be in the game

    Quickly master: How to open two WeChat accounts on Huawei mobile phones revealed! Quickly master: How to open two WeChat accounts on Huawei mobile phones revealed! Mar 23, 2024 am 10:42 AM

    In today's society, mobile phones have become an indispensable part of our lives. As an important tool for our daily communication, work, and life, WeChat is often used. However, it may be necessary to separate two WeChat accounts when handling different transactions, which requires the mobile phone to support logging in to two WeChat accounts at the same time. As a well-known domestic brand, Huawei mobile phones are used by many people. So what is the method to open two WeChat accounts on Huawei mobile phones? Let’s reveal the secret of this method. First of all, you need to use two WeChat accounts at the same time on your Huawei mobile phone. The easiest way is to

    How to set font size on mobile phone (easily adjust font size on mobile phone) How to set font size on mobile phone (easily adjust font size on mobile phone) May 07, 2024 pm 03:34 PM

    Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual

    The difference between Go language methods and functions and analysis of application scenarios The difference between Go language methods and functions and analysis of application scenarios Apr 04, 2024 am 09:24 AM

    The difference between Go language methods and functions lies in their association with structures: methods are associated with structures and are used to operate structure data or methods; functions are independent of types and are used to perform general operations.

    See all articles