Home > Backend Development > PHP Tutorial > Summary of common problem modification methods in power by dedecms dedecms

Summary of common problem modification methods in power by dedecms dedecms

WBOY
Release: 2016-07-29 08:36:55
Original
3660 people have browsed it

Frequently Asked Questions for Newbies, this post was posted by me earlier, in the official version 3.1. Some problems have been corrected, but they can still be used as a reference for modification or learning
Please be patient and read this, many people are worried about these problems I have encountered it. Why keep posting questions?
In addition, after reading this, please go to your own backend and read the template tag reference!! Especially the parameter description of the arclist tag!!
Think more about the problem, Experiment more with markup, and what you learn is your own. If you can’t learn it, no one can help you!!
One more thing.. For many marks, you can refer to the system default templates and some good templates in the template area. Read more about markup experience. The usage of each tag,
If there is your post below...Thank you for your comment on DEDE?.
3.1lit latest version When the first-level column is the final list column, the list displays the articles of its lower-level columns Modify
include/inc_arclist_view.php
line 80:
$addSql .= " And (typeid='".$this->TypeID."' or typeid2='".$this->TypeID."') " ;
Changed to:
//Added to solve the problem that the upper-level list cannot call the lower-level list
$ssid = TypeGetSunID($this->TypeID,$this->dsql);
$ssid2 = str_replace( 'typeid','typeid2',$ssid);
//End adding
$addSql .= " And (typeid='".$this->TypeID."' or ".$ssid." or typeid2= '".$this->TypeID."' or ".$ssid2.") ";//This sentence has also been modified
The above part is used to solve the paging problem
include/inc/inc_fun_SpGetArcList.php
Start at line 70 :
if($ridnum>1){
$tpsql = "";
for($i=0;$i<$ridnum;$i++){
if($tpsql=="") $tpsql .= " And (".TypeGetSunID($reids[$i],$dsql,'arc');
                                                                                                                                 .
$tpsql .= ") ";
$orwhere .= $tpsql;
unset($tpsql);
else{
$orwhere .= " And ".TypeGetSunID($typeid,$dsql, 'arc') ;
}
Changed to:
if($ridnum>1){
$tpsql = "";
for($i=0;$i<$ridnum;$i++){
if($tpsql=="" ) {
                                                                                                           ; ;
}
else{
$ssid = TypeGetSunID($typeid,$dsql,'arc');
$ssid2 = str_replace('typeid','typeid2',$ssid);
$orwhere .= " And (".$ssid ." or ".$ssid2.") ";//End the modification of the second column of the article calling issue
}
This part is used to solve the problem of calling the lower-level column article list
The replacement code I wrote is very rough, you can use it temporarily, and then replace it after the official solution comes out
There is one more thing to change in include/inc_arclist_view.php:
//Get a single-column document list
Next
//Conditions for category ID
$orwhere .= " And (#@__archives.typeid='".$this->TypeID."' or #@__archives.typeid2 ='".$this->TypeID."') ";
Changed to:
//Conditions for category ID
$ssid = TypeGetSunID($this->TypeID,$this->dsql);
$ orwhere .= " And (#@__archives.typeid='".$this->TypeID."' or ".$ssid." or #@__archives.typeid2='".$this->TypeID."' ) ";
Otherwise there is a page without list content, because line 80 is Select count(*)...
There is {cmspath} about that column path
First of all, let’s talk about the meaning of {cmspath}, and open the background "system You can see the second item in "Configuration Parameters", DedeCms installation directory:
This is the path parsed by {cmspath},
If beta2 is upgraded to lit, you need to manually modify the column properties and remove {cmspath}. Or you can run setup upgrade After that, replace all the previous files of B2 with all the files of lit
, so that {cmspath} can be parsed into your website path normally
If you don’t use the {cmspath} parameter, you can execute the SQL as follows
: update dede_arctype set typedir=replace(typeidr,'{cmspath}','');
To remove {cmspath} from the database
Then modify the file catalog_add.php to find $true_typedir = str_replace("{cmspath}",$cfg_cmspath, $typedir);
Change to
$true_typedir = str_replace("",$cfg_cmspath,$typedir);
That’s it
[field:description /]How to limit the number of words in this tag?
[field:description function='cn_substr(@me ,80)'/]
All tags in dede support the use of functions in this way
About the problem that friendly links in version 3.1 are not displayed on the homepage after they are added
The main reason for this is that BLT changes the ischeck of the table dede_flink when writing The value is reversed.
In 3.01, ischeck=1 means home page link. 2 means internal page link, but 3.1 is just the opposite.
The simplest way to change it is to open inc_fun_SpGetFriendLink.php
Find line 13 ..
CODE:
$wsql = " where ischeck=1 ";
[Copy to clipboard]
Just change 1 to 2.
After the 11.11 update, the call to the inc_fun_SpGetFriendLink.php file has been cancelled.
So you only need to Open inc_arcpart_view.php
near line 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]
Similarly change where ischeck=1 to 2
3.1 Solution to the invalidity of the modified advertising name in the LIT version
http://bbs.dedecms.com/read.php?tid=7135
See the reply on the 4th floor.
How to remove the article summary from the list in the new version of dede
Delete [field :info/]
About the modification of the background login verification code style
http://bbs.dedecms.com/read.php?tid=6244
When the English length in the article description is greater than the width of the table, it will cause trouble Ugly
[field:textlink /]
Changed to
[field:title function='cn_substr(@me,30)' /]
New channel model tutorial
http://bbs.dedecms.com/read.php?tid=5972
dedecms implements dual styles of list page




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

I want to To implement a function, in the article list (template list_article), if the article has a thumbnail, the thumbnail will be displayed. If not, the article list will be displayed directly without displaying the "no thumbnail" picture.
The extension of dedecms is in function form, because adding an if structure takes up too much resources. If you need it, you can do this:
[field:picname function="GetMyPic('@me')"/]
In inc_functions Define a function in .php
function GetMyPic($img)
{
if($img=="") return "";
else return "";
}
Processing it this way
This approach may be a bit inconvenient, but the advantage is that it achieves the purpose of expansion without taking up too many resources, and does not affect the template structure, achieving true Template and code separation
Click on the picture to go to the next page
Open include/inc_archives_view.php
About line 444, find
$this->Fields[$this->SplitPageField]=$this->Fields[ $this->SplitPageField];
Comment out and change to
$this->Fields[$this->SplitPageField]=$this->ClickPicNext($this->Fields[$this->SplitPageField ]);
Then, add the function at the end, pay attention to the last bracket!
//Replace the picture with a link
//--------------------- -------
function ClickPicNext(&$body)
{
if($this->NowPage!=$this->TotalPage){
$lPage=$this->NowPage+1;
$body=preg_replace("/<(img|IMG)(.*)(src|SRC)=["|'| ]{0,}((.*)>)/isU",""."${0}"."" ,$body);
//$body="" .$body." ";
}else{
if($this->GetNext()){
$body=preg_replace("/<(img|IMG)(.*)(src |SRC)=["|'| ]{0,}((.*)>)/isU","". "${0}"."",$body);
//$body="".$ body.” Note: You must first follow the following modification method to separate the previous article and the next article!
[dede3.1][Modified method] The previous article and next article are called separately, and the column of the article is limited to the current one. Full Site.
http://bbs.dedecms.com/read.php?tid=5051
In the article list, some titles are truncated. What kind of code can be used to display the complete file name when the mouse is on it?
{dede:arclist row=16 orderby=pubdate col=1 typeid=3}
  • · [ field:title function="cn_substr('@me',30)" /]

  • {/dede:arclist}
    How to display the article column in front of the article name?
    { dede:arclist row=10 orderby=pubdate}
    ·[field:typelink/] [field:textlink/]

    {/dede:arclist}
    Can you add MD5 encryption to the generated article file name
    Myself Change it, this is a typical boring requirement
    include/inc_channel_unit_functions.php
    .
    [field:writer /] is useless
    The lit version of inc_arcpart_view.php does not read the additional table
    Modify line 120 of includeincinc_fun_SpGetArcList.php, in Add arc.writer at the end,
    Of course you can also add additional table content you want to introduce, such as:
    arc.writer, arc.source, arc.shorttitle,
    For the newly installed DEDECMS3.0.1, say me when you log in for the first time. Wrong password!
    You need to check if there is a dede_admin table. If so, see if there is any data.
    If the user name and password do not have impermissible symbols,
    Generally, the server may not be able to complete the SQL import of the installation. It prompts that the user name does not exist.
    Add a user manually and it will be OK.
    You can also delete the table dede_admin in the database and then reinstall it.
    About listpage pagination, there will be table modifications during generation.
    Search.
    //Get a static paging list.
    You can see some paging stuff in the following lines
    About the issues of multiple column styles and system underlying templates
    Use arclist
    {dede:arclist
    typeid='' row='' col='' titlelen=''
    infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword=''}
    Custom style template (InnerText) //Define the style you display here. Don't modify the underlying template. .Save yourself trouble.
    {/dede:arclist}
    You don’t need to use the system default {style}/list_article.htm for other column templates
    You can manually specify the cover template or list template of the column... For example: {style}/list_class1.htm
    {style}/list_class2.htm
    Wait. This way you can have multiple styles.
    The idea of ​​using dedecms to build a novel website
    1. Create two new models
    book model and chapter model
    2. The key to rewriting the file publishing program is to associate the two models. However, cmsware and dede, which currently provide content models, cannot do this. However, the file publishing program items provided by dede's self-built channel can be put to good use. Just re-install these four files (two interfaces and two post-submission processing programs).
    3. If you want to build a model for Qidian Chinese website, you need to write the program for submission in the member directory, and the program for the business model such as billing, point counting and other functions in plus.
    In fact, dede is just a content publishing framework, and the background tools provided are only for administrators. Users can completely customize various models, but they need to be familiar with dede.
    Those who can write programs may wish to give it a try.
    Why are my custom tags always output as text?
    The ismake='yes' attribute should be added to the tag.
    Some thoughts on image SEO,
    [field:title /]
    Refer to arclist mark Explanation,
    dede editor problem.. Error copying from WORD
    After copying, install the paste button with a yellow T in the lower right corner of the toolbar~~~Move it up and there will be a prompt, paste without format
    Put the definition of the label Where is it? For all files in the include, there is ***view.php that controls the view. Regarding the issue of automatic paging, the size of automatic paging can only be before 2-5. 3 means that each paging is 3K means.
    This is different from Dongyi. Dongyi is in bytes, so you can write 2000 or 3000. DEDE is K, so you can only write 2 or 3. My mistake is, I wrote 2000K! Sorry,
    This means in DEDE that one paging is allowed to be 2M! Of course it was unsuccessful
    About the pagination title
    The content part can be in the following format:
    Page title 1#e#
    Page 1 content
    #p#Page title 2#e#
    Page 2 content
    #p#Page title 3#e#
    Content on page 3
    #p# Pagination title 4#e#
    Content on page 4
    .
    .
    .
    .
    .
    .
    Additional options: How to turn off downloading remote images and resources? ? ?
    dede/article_add.php and article_edit.php are found (if it is other models, find the corresponding add and modify files)
    Additional options:

    Download remote images and resources
    Change value to 0 Delete checked
    3.1B2/// Temporary solution to the BUG of channelArtlist and arclist
    Fixed that all column lists are the same and the arclist label under channelArtlist cannot be customized
    Open include/inc_arcpart_view.php
    Find line 207
    else $typeid = 0;
    Then delete it
    - ------------------------
    Open include/inc/inc_fun_SpGetChannelList.php
    Find on line 66
    $ctag->GetAtt('innertext')
    Change Just
    $ctag->GetInnerText()
    .
    If you have any questions, you can also join the group: 18176791
    Haha. If you can see this, it means you are sincerely working on the website! I wish you success!!

    The above has introduced a summary of common problem modification methods in power by dedecms dedecms, including the content of power by dedecms. I hope it will be helpful to friends who are interested in PHP tutorials.

    Related labels:
    source:php.cn
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template