Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of making Imperial Cms template and calling Forum posts

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the empire Cms template production method of calling forum posts, with a certain reference value, friends need to refer to the next. I hope you will have a lot of success after reading this article. Let's take a look at it together.

Note: Discuz supports X3.1 here, and it is tested correctly on the home page of the webmaster zone. The webmaster zone uses method 2, which is the smart label call.

Method 1:

The forum data call is realized by combining the ecmsinfo tag with the call by SQL.

Key points of use:

1. Use ecmsinfo tag;(click here to view ecmsinfo tag usage tutorial)

Tag syntax: [ecmsinfo] Column ID, Number of items displayed, Number of title interceptions, Whether to display column name, Operation type, Template ID, Only display images with title [/ecmsinfo]

2. Use the operation type of "query by sql" in the label;

Column ID in label parameter is SQL statement; Operation Type is 24.

3. Make a display style template

Use "[!--" in label template title--]"Post title;"[!-- id--]"indicates the post ID.

Example tag syntax:

[ecmsinfo]'select post title field as title, post ID field as id from post data table order by sort field desc limit number of calls',0, number of words intercepted in title, 0,24, template ID,0[/ecmsinfo]

For example: (Call the latest 10 posts on the forum)

DISCUZ Forum: [ecmsinfo $>'select subject as title,tid as id from pre_forum_thread order by tid desc limit 10',0,30,0,24,1,0[/ecmsinfo]

PHPWIND forum: [ecmsinfo $>'select subject as title,tid as id from pw_threads order by tid desc limit 10',0,30,0,24,1,0[/ecmsinfo]

(Note: If the forum and Empire CMS are installed in different databases, use "Database. Data table "means, for example,"discuzdb.cdb_threads".)

·Example: Call DISCUZ forum post

Call DISCUZ forum post tag syntax:

[ecmsinfo]'select subject as title,tid as id from pre_forum_thread order by tid desc limit 10',0,30,0,24,7,0[/ecmsinfo]

Number of posts invoked is 10; number of post title interceptions is 30 words; template with tag template ID=7 is used. (Note: If you change the database prefix, please change it accordingly.)

Make a display style template:

Log in to the background->"Template Management"->"Add Label Template," and add two label templates of "Display one row and one column" and "Display multiple columns in one row" respectively.

After adding, return to the "Tag Template" management, you will see the two tags we just added. (www.zzarea.com website construction)

Now let's modify the home page template:

Log in to the background->"Template Management"->"Public Template"->"Modify Home Template", copy the template content to Dreamweaver Editor, and add the label of calling forum posts in the template, as shown below:

(Note: "where fid= forum ID" refers to calling posts by forum forum.)

After modifying the home page template, copy the template code content to the background home page template text box, and then click Modify.

After modifying the home page template, we click "Preview" to view the modified home page effect. Hehe, is it possible to move all posts on the forum to Empire CMS?

Other Notes: The SQL statement above is an example of calling forums and new sections, you can also call popular posts, elite posts, etc., just change the sort and condition of the SQL statement. There are many more applications, such as calling related forum posts in information pages, calling other system data, and so on.

Method 2: Use the smart tag [e: loop] to call the forum post

Call Discuz Latest Post: pre_is the table prefix of Discuz

[e:loop={"select tid,subject from pre_forum_thread order by tid desc limit 10",10,24,0}]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report