DedeCMS learning

WBOY
WBOYOriginal
2016-07-29 09:15:221206browse

Perhaps some readers don’t know dedecms. Here is a brief introduction: DedeCMS is a free and open source content management system. It is a content publishing system (CMS) that can be used independently. DedeCms is famous for its simplicity, practicality and open source. It is the most well-known PHP open source website management system in China and the PHP CMS system with the most users. Simply put, it is used to build the backend. . (Dreamweaver and dedecms have the same meaning in the article)

To use dedecms, you must first download: Download dedecms

Warning for multiple pictures, it is recommended to watch on a computer! ! !

①: The next step is to install Dreamweaver. First, unzip Dreamweaver and put it in a folder, and put it in the server path. For example, create a folder dedecms under the www folder (I use phpstudy), and put the decompressed Dreamweaver in this folder, as shown in the picture:

DedeCMS learning

Then open http://localhost/dedecms, Jump to this page

DedeCMS learning

Then fill it out step by step:

DedeCMS learningDedeCMS learning

No need to modify the one on the left, fill in your own on the right. Note that the database password user is correct, and the data table prefix is ​​not recommended. Change the database name to whatever you want. The administrator password and user name are arbitrary, as long as you remember them. Website name and administrator email can be changed. If the URL and installation directory are local, you don’t need to change them

DedeCMS learningIgnore it if you don’t need to experience it (usually just ignore it, so don’t check it, click continue)

DedeCMS learningThe installation is complete, is it very simple? You can log in to the backend with the administrator user and password

②: After logging in, enter this interface and familiarize yourself with the backend interface agent function. You can also enter the backend by logging in to localhost/dedecms/dede. Of course, this is the way for my test

DedeCMS learning (The red area is more commonly used)

Core: manage channels, manage columns (this is a must)

Generate: change homepage HTML, update column HTML, update document HTML, etc.

System: can be set a lot of things. For example, setting system parameters, removing watermarks, database backup and restoration, etc.

DedeCMS learning

You can also add new variables

The previous ones are just some understanding of installation. Let’s explain it through a simple example

First of all, I want to implement an article publishing function , click on the title to view the article, the article has title, picture and text

has such a function, click on the corresponding article to view, the article list and content are dynamically generated by the background:

DedeCMS learningDedeCMS learning

Step 1: Add new Model

Analysis: From the perspective of the database, three fields need to be created, namely article tiitle, image img, and content. Return to dede and log in first. The background path here is localhost/dedecms/dede. After logging in, click The 6 lists in the red area

DedeCMS learning-------->DedeCMS learning

(products, software, photo albums, general articles, special topics, classified information) are all systematic and not what we want them to be. So ignore him and let's rebuild a model. Building a model is equivalent to creating a table in the database, and the data in it is what we will call in the subsequent column (template page). Click to add a new model.

This page doesn’t need to be modified much. It doesn’t matter whether the channel id and name tag are changed or not. The channel name can be changed. Here it is changed to a test channel. Additional tables are tables created in the database. It doesn't matter whether the name is good or not. You can check the box to delete existing tables. Then the rest of this page can be left unchanged and completed.

DedeCMS learning

After creation, if you are interested, you can open phpmyadmin, and you will see that a new table named dede_addon17 has been added to the dedetest database. The dedetest database is created in the database when we install it. The name is defined by ourselves. You can return to the previous installation to view it. There is no data in the open table.

DedeCMS learningDedeCMS learning

Back to dede. After creating the model, fields can be set on the right. Those who have understood PHP and databases should know what fields are. A field is a new column in the database that stores a type of data. For example, the name field in the address book, etc. In dedecms, when publishing content, the system will automatically generate some fields. Commonly used system fields include title (required), thumbnail picname (the first picture is obtained by default), article summary description (if there is a content field, the previous paragraph is intercepted by default, if not, you can fill it in yourself). Here is a paragraph. Text, explain in detail

arclist underlying template field, list of fields that can be called

Use DedeCMS to make a website, arclist is the most commonly used tag, because it is the basic tag for calling articles, and its function is also very powerful. Its underlying fields There are quite a lot of them. We haven’t used half of them in daily use, but because we don’t know all the underlying fields, which are originally things that come with tags, I will still think about how to call the desired data, so I understand all the underlying fields. Template fields will get twice the result with half the effort when building a website. Below I will list all the fields supported by the arclist title with descriptions.
Copy code
1.[id] => Article ID
2.[typeid] => Column ID
3.[typeid2] => Sub-column ID
4.[sortrank] => Document sorting
5 .[flag] => Custom attributes
6.[ismake] => Whether to generate static HTML
7.[channel] => Channel model ID
8.[arcrank] => Browse permission
9.[ click] => Number of clicks
10.[money] => Need to consume gold coins
11.[title] => Article title
12.[shorttitle] => Article short title
13.[color] => ; Title color
14.[writer] => Article author
15.[source] => Article source
16.[litpic] => Thumbnail
17.[pubdate] => Update time
18. [senddate] => Release time
19.[mid] => Release member ID
20.[keywords] => Article keywords
21.[lastpost] => Last reply time
22.[scores] => Points consumed
23.[goodpost] => Number of positive reviews
24.[badpost] => Number of bad reviews
25.[voteid] => Voting ID
26.[notpost] => Whether to allow reply
27.[description] => Article summary
28.[filename] => File name
29.[dutyadmin] => ID of the administrator responsible for review
30.[tackid] => Me I don’t know either
31.[mtype] => Calculate the definition category
32.[weight] => Sorting weight
33.[typedir] => Column generation directory
34.[typename] => Column name
35.[corank] => Column browsing permissions
36.[isdefault] => I don’t know either
37.[defaultname] => The default name of the column
38.[namerule] => Column article naming rules
39.[namerule2] => Column list naming rules
40.[ispart] => Column attributes (channel or final list)
41.[moresite] => Whether multi-site support is enabled
42.[siteurl ] => Site domain name after turning on multi-site
43.[sitepath] => Site path after turning on multi-site
44.[infos] => Article summary
45.[info] => Article summary
46.[arcurl] => Article URL
47.[typeurl] => Column URL
48.[picname] => Thumbnail
49.[stime] => Update time in YYYY-MM-DD format
50.[typelink] => Column link
51.[image] => Thumbnail complete image label
52.[imglink] => Image label with link
53.[fulltitle] => Article Complete title
54.[textlink] => Complete A-tagged article link
55.[phpurl] => Plug-in directory
56.[plusurl] => Plug-in directory
57.[memberurl] => Personal center Directory
58.[templeturl] => Template directory

I mentioned a big recommendation before. In fact, if you want to implement this example, it is very simple: Continue the model you just created. There is no need to add new fields on the right, because we can all Use title for the system field title, picname for the picture, and abstract for the article content for the time being. Although the number of words is not many, it is simpler. You can use system fields directly without adding new fields. In this way, the sub-channel model is created.

Step 2: Place the written front-end interface in the dede directory.

First look at the simple front-end interface

<span><span>DOCTYPE html</span><span>></span><span><span>html </span><span>lang</span><span>="en"</span><span>></span><span><span>head</span><span>></span><span><span>meta </span><span>charset</span><span>="UTF-8"</span><span>></span><span><span>title</span><span>></span>articlelist<span></span><span>title</span><span>></span><span></span><span>head</span><span>></span><span><span>body</span><span>><br></span><span><span>ul</span><span>></span><span><span>li</span><span>><span>a </span><span>href</span><span>="###"</span><span>></span>文章一<span></span><span>a</span><span>></span><span>li</span><span>></span><span></span><span>ul</span><span>></span><span></span><span>body</span><span>></span><span></span><span>html</span><span>></span></span></span></span></span></span></span></span></span></span>

<span><span>DOCTYPE html</span><span>></span><span><span>html </span><span>lang</span><span>="en"</span><span>></span><span><span>head</span><span>></span><span><span>meta </span><span>charset</span><span>="UTF-8"</span><span>></span><span><span>title</span><span>></span>list<span></span><span>title</span><span>></span><span></span><span>head</span><span>></span><span><span>body</span><span>></span><span><span>ul</span><span>></span><span><span>li</span><span>><span>a </span><span>href</span><span>="###"</span><span>></span>文章一<span></span><span>a</span><span>></span><span>li</span><span>></span><span><span>li</span><span>><span>img </span><span>src</span><span>="img/1.jpg"</span><span> alt</span><span>=""</span><span>></span><span>li</span><span>></span><span><span>li</span><span>></span>我是文章一的内容<span></span><span>li</span><span>></span><span></span><span>ul</span><span>></span><span></span><span>body</span><span>></span><span></span><span>html</span><span>></span></span></span></span></span></span></span></span></span></span></span></span></span>

就这2个页面,很简单。第一个命名为index.html,第二个界面命名为test.html。让后放在test文件夹下。接下来将test文件夹放在dede目录下。

就放在:dedecms/templets/default下,这就是dede的默认模板目录。

放好后如下图:

DedeCMS learning

从图片中可以看到,模板的后缀名都是htm的,所以进入tese,将index.html跟test.html改为index.htm和test.htm。到此,就已经将前端模板放好位置了。

第三步:新增网站栏目

回到dede的后台,点击新增栏目。

DedeCMS learning

DedeCMS learning

我想先设置一个频道封面,再在频道封面里面设置最终列表页。2者的区别是频道封面不允许发布文档,可以显示多个列表页。最终列表页可以发布文档。

在设置封面页时,点击频道封面,栏目名称自己定义栏目列表选项使用动态页,转到高级选项,DedeCMS learning

在浏览里面找到test文件夹下面的index.htm,将其作为封面模板,然后点确定。就这样封面模板设置好了。然后再其下面增加子类,就是文章详情列表

DedeCMS learningDedeCMS learning

转到高级选项,将文章模板改为test.htm

DedeCMS learning

到此,栏目就设置好了。

 第四步:使用简单的dede代码。

第二步的时候直接将2个页面放在dede下,如果没有对其代码进行修改,是无法实现功能的。关于dede的代码,可以详情查看手册。

在详情页中调用字段使用{dede:field name='title’/}、{dede:field.title/}
在列表页调用字段使用:
{dede:list}
我是标题:[field:title/],我的的url:[field:youku_url/]


我的正文内容:[field:work_body/]



{/dede:list}
ps:如果是自定义的字段需要内容模型管理-所选频道的基本设置-列表附加字段中追加,多个字段用,号分割

在首页或者任意位置调用字段:
{dede:arclist typeid="12" channelid="17" addfields="youku_url"}
标题是:[field:title/]


视频地址:[field:youku_url/]



{/dede:arclist}


list跟arclist都可以循环输出,而list用于当前栏目,主要用于列表页调用字段,而arclist使用范围更广,在首页或者任意位置调用字段。如果是详情页,调用字段时使用{dede:field name='title’/}这种格式输出。

如果arclist中有自定义字段,并且要输出此字段时(像上面的优酷地址就是自定义的),就要加上addfields="youku_url",且加上该字段属于哪个频道的 channelid="17" 。如果是list中有自定义字段,就在dede中修改。修改方法:内容模型管理--->选择对应的频道DedeCMS learning,点击更改,在DedeCMS learning列表附加字段中写上字段名。

所以,这样子修改index.htm跟test.htm

test.htm:

<span><span>DOCTYPE html</span><span>></span><span><span>html </span><span>lang</span><span>="en"</span><span>></span><span><span>head</span><span>></span><span><span>meta </span><span>charset</span><span>="UTF-8"</span><span>></span><span><span>title</span><span>></span>{dede:global.cfg_webname/}<span></span><span>title</span><span>>   <!--dede中title--></span><span></span><span>head</span><span>></span><span><span>body</span><span>></span><span><span>ul</span><span>></span><span><span>li</span><span>><span>a </span><span>href</span><span>="{dede:field name='arcurl'/}"</span><span>></span>{dede:field name='title'/}<span></span><span>a</span><span>></span><span>li</span><span>>   <!--{dede:field name='arcurl'}获取路劲,{dede:field name='title'}是获取文章标题--></span><span><span>li</span><span>></span>{dede:field name='senddate' function="MyDate('Y-m-d H:i',@me)"/}<span></span><span>li</span><span>>      <!--获取发布时间,并且按照后面格式输出--></span><span><span>li</span><span>><span>img </span><span>src</span><span>="{dede:field name='picname'/}"</span><span> alt</span><span>=""</span><span>></span><span>li</span><span>>                       <!--获取缩略图,默认第一张图片--></span><span><span>li</span><span>></span>{dede:field name='description'/}<span></span><span>li</span><span>>                       <!--获取摘要--></span><span></span><span>ul</span><span>></span><span></span><span>body</span><span>></span><span></span><span>html</span><span>></span></span></span></span></span></span></span></span></span></span></span></span></span></span>

 index.htm:

<span><span>DOCTYPE html</span><span>></span><span><span>html </span><span>lang</span><span>="en"</span><span>></span><span><span>head</span><span>></span><span><span>meta </span><span>charset</span><span>="UTF-8"</span><span>></span><span><span>title</span><span>></span>{dede:global.cfg_webname/}<span></span><span>title</span><span>></span><span><span>link </span><span>rel</span><span>="stylesheet"</span><span> href</span><span>="{dede:global.cfg_templets_skin/}/test/css/index.css"</span><span>>    <!--如果有css文件,要这么加,修改路劲方法参考--></span><span></span><span>head</span><span>></span><span><span>body</span><span>></span><span><span>ul</span><span>></span><span>        {dede:arclist typeid="1"}                                   <!--频道ID是1-->
            </span><span><span>li</span><span>><span>a </span><span>href</span><span>="[field:arcurl/]"</span><span>></span>[field:title/]<span></span><span>a</span><span>></span>[field:arcurl/]<span></span><span>li</span><span>></span><span>        {/dede:arclist}
    </span><span></span><span>ul</span><span>></span><span><span>script </span><span>src</span><span>="{dede:global.cfg_templets_skin/}/test/js/jquery-1.11.3.min.js"</span><span>></span><span>script</span><span>></span><span></span><span>body</span><span>></span><span></span><span>html</span><span>></span></span></span></span></span></span></span></span></span></span></span></span>

 到此,后台搭建成功。

第五步:更改网站主页,以及解决不能及时更新栏目问题。

更改主页:DedeCMS learning选择主页模板选择test的index.htm,点击更新主页。

及时更新栏目:

DedeCMS learning

在性能选项下修改:

DedeCMS learning将缓存设置为1秒,这样随时都是最新的。下面3个选项也勾是。

You can also update the website manually: Generate---->Update website with one click---->Start updating

Step 6: Publish the first article.

DedeCMS learningClick on the test details page to enter publishingDedeCMS learning

DedeCMS learningDedeCMS learning

As you can see from the picture, there are many options when publishing an article, which can be obtained through system fields.

The effect is as follows:

DedeCMS learning (The tail behind is the link to article one, I also exported it), after clicking article one

DedeCMS learningThis is the published article

Continue publishing:

DedeCMS learningYou can see The path is different for every article.

I’ll just write it here for now, and I’ll update it if I have new ideas.

The above introduces DedeCMS learning, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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