Home > CMS Tutorial > DEDECMS > body text

How to make a single page of DreamWeaver

藏色散人
Release: 2019-12-27 09:10:16
Original
1973 people have browsed it

How to make a single page of DreamWeaver

How to make a single page of DreamWeaver?

We know that the template calling tag for single-page content is {dede:field.content/}. After testing, it is used on the homepage. Since this method has limitations, we can also use SQL. In this way, the flexibility is greatly improved, and the single-page content of any column ID can be called

Recommended learning: 梦Weavercms

The code is as follows:

{dede:field.content/}
Copy after login

This tag system only supports calling in column templates, not content templates. If you want content templates to also support it, it's actually very simple. Just add a line of code to archives.class.php in the core directory, include/.

Copy the code as follows:

$this->Fields['content']=$this->TypeLink->TypeInfos['content']; //Add line 86 This code

How to call the column content that has been made into a single page to the home page.

Commonly used single-page content that needs to be transferred to the homepage, such as company profile, contact us, etc., may be displayed on the homepage. Through conventional methods, including consulting dede official forum information, I can't find a more suitable answer. Today we provide two ways to call.

1. We know that the template calling tag for single-page content is {dede:field.content/}. After testing, the

code used on the homepage is as follows:

  {dede:channelartlist } 
   {dede:field.content/} 
  {/dede:channelartlist }
Copy after login

By making a call, the relevant data can be retrieved smoothly.

But there is a problem. This call can only be used when there is only one single page. If the system contains two or more single pages, this call will stack and display the contents of all single pages. . Even adding the type ID to limit it has no effect. So this method is not very suitable

2. We can also use SQL to call, which greatly improves the flexibility and can call the single-page content of any column ID.

The code is as follows:

  {dede:sql sql='Select content from dede_arctype where id=1'} 
   [field:content/] 
  {/dede:sql}
Copy after login

If you want to call that column, you only need to modify the ID of the column; but one thing to note is that the "dede_arctype" table name should be based on the table when you installed the system. Fill in the name, otherwise it won’t be called

But sometimes we don’t need to display all the text in a column, so we need to intercept a part of it on the home page. So how to implement it? Look at the code, or use sql , intercept the calling data.

For example: Select content, substring(content,1,280) as content from dede_arctype where id=1

This sentence means to intercept 1-280 characters of the content of the ID1 column.

The above is the detailed content of How to make a single page of DreamWeaver. For more information, please follow other related articles on the PHP Chinese website!

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