Home  >  Article  >  CMS Tutorial  >  What is the function of include tag in dedecms

What is the function of include tag in dedecms

藏色散人
藏色散人Original
2019-07-24 10:46:403521browse

What is the function of include tag in dedecms

What is the function of the include tag in dedecms?

The include tag in dedecms is to introduce a file.

Code form:

{dede:include filename="文件路径"/}

This tag can help us reuse code very well, that is, like some commonly used codes, such as head, bottom, this It can be used in every page, then we write it into a separate file, such as the head is written as head.htm and the bottom is written as footer.htm, and then only need to use the include tag to include them in each page Just introduce it. Isn’t it much better to write it this way than adding repetitive code? The page can also be optimized better.

Example:

First we write a test.htm. This file will be introduced in the home page template later. We use dw to make a simple htm web page , named test.htm. We have skipped the process of making a simple HTML web page, it is too simple.

After the test.htm web page is completed, we next go to the home page template index.htm and use the include tag to introduce the file (test.htm). We are in 6c04bd5ca3fcae76e30b72ad730ca86d36cc49f0c466276486e50c850b7e4956 Add include tags between them to introduce the content of the test.html page. The code is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试主题include标签引入</title>
</head>
 
<body>
{dede:include filename="test.htm"/}
</body>
</html>

For more dedecms technical articles, please visit the dedecms usage tutorial column!

The above is the detailed content of What is the function of include tag in dedecms. For more information, please follow other related articles on the PHP Chinese website!

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