Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of realizing Chinese and English paging function by weaving dreams in dedecms

Shulou Source: shulou.com Published: 2022-06-02 04:37:24 10月28日 Update

Editor to share with you dedecms dream weaving to achieve Chinese and English paging function, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

How to realize the paging function in Chinese and English with dedecms dream weaving?

Preface

When I was working on a project, I encountered a demand. Because it is a Chinese and English version of the website, paging also needs corresponding English. After searching in forums, Baidu and other places for a long time, I couldn't find a satisfactory answer. However, I found the following article today and tested it. I found that it is suitable for the latest 5.7 version of Weaving Dream, and it has been successfully implemented, so I would like to share with you:

Warm Tip: the following lines, which lines can be ignored, use DW's search function to index, you can easily find the object code. And some of the following code can not be searched, just because of some "space" problems, you can find it when you modify it.

1. Open include/arc.listview.class.php (this article takes DedeCMS5.7 as an example)

Find (about 29 lines)

Var $remoteDir

Add a new line below it

Var $pagelang

Find (about 528 lines)

$list_len = trim ($ctag- > GetAtt ("listsize"))

Add a new line below it

$pagelang = trim ($ctag- > GetAtt ("pagelang"))

Find (about 531 lines)

If ($list_len== "") {$list_len= 3;}

Add under it

If ($pagelang== "") {$pagelang= 'cn';}

Modify (approx. 545 lines)

$this- > dtp- > Assign ($tagid,$this- > GetPageListST ($list_len,$listitem))

For

$this- > dtp- > Assign ($tagid,$this- > GetPageListST ($list_len,$listitem,$pagelang))

Modify (add)

Function GetPageListST ($list_len,$listitem= "index,end,pre,next,pageno")

For

Function GetPageListST ($list_len,$listitem= "index,end,pre,next,pageno", $pagelang='cn')

Modify (about 826 lines)

Return "1 page total". $this- > TotalResult. "record\ r\ n"

For

If ($pagelang=='cn') {return "1 page total". $this- > TotalResult. "record\ r\ n";} else {return "Total 1Page". $this- > TotalResult. "Records\ r\ n";}

Modify

Return "of 0 pages". $this- > TotalResult. "record\ r\ n"

For

If ($pagelang=='cn') {return "0 pages of". $this- > TotalResult. "record\ r\ n";} else {return "Total 0 Page". $this- > TotalResult. "Records\ r\ n";}

Modify

$maininfo = "total {$totalpage} pages". $this- > TotalResult. "Article\ r\ n"

For

If ($pagelang=='cn') {$maininfo = "total {$totalpage} pages". $this- > TotalResult. "Article\ r\ n";} else {$maininfo = "Total {$totalpage} Page". $this- > TotalResult. "Records\ r\ n";}

According to the above method, modify the following to get the contents of the previous page, the home page, the next page, and the last page

2. Open the list template page. I will take list_article_en.htm as an example, where list_article_en.htm is the English version of the list page template, while the Chinese version does not need to be modified.

Modify

{dede:pagelist listsize='5'/}

For

{dede:pagelist pagelang='en' listsize='5'/}

The list page was regenerated successfully. However, there is another drawback is that although all English pagination of the list page has been realized, the functions of "previous", "previous" or "next" and "next" of the article page have not yet been completed. The editor will study it and continue to share it with you.

The above is all the contents of the method of dedecms dream weaving dream to achieve the function of paging in Chinese and English. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Function Chinese and English content method face previous English search success code place time template article page new line warm imperfect not much no need Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB MySQL OPPO Reno Microsoft