{dede:arclist flag=h'

99ANYc3cd6
预计阅读时长 20 分钟
位置: 首页 DEDE建站 正文

Of course. Let's break down the DedeCMS tag {dede:arclist flag='h'}.

{dede:arclist flag=h'
(图片来源网络,侵删)

This is one of the most commonly used tags in DedeCMS for displaying content on the homepage.

Quick Summary

{dede:arclist flag='h'} is a DedeCMS tag that calls a list of articles that have been manually set as "Headlines" or "Highlights" in the DedeCMS后台 (backend/admin panel).

  • {dede:arclist}: The main tag for calling a list of articles.
  • flag='h': The parameter that filters the list to show only articles marked with the flag 'h'.

Detailed Breakdown

The Parent Tag: {dede:arclist}

This is the core tag for fetching article data from the database. It's highly versatile and can be customized with many parameters to control what articles are shown and how they are displayed.

Common parameters for {dede:arclist} include:

{dede:arclist flag=h'
(图片来源网络,侵删)
  • typeid: (integer) Show articles from a specific category ID.
  • row: (integer) The number of articles to display (e.g., row='10').len`: (integer) The length of the article title in characters.
  • infolen: (integer) The length of the article summary (introtext).
  • orderby: (string) Sort order (e.g., orderby='pubdate' by publish date, orderby='hot' by clicks/views).
  • flag: (string) Filter by article flags.

The Parameter: flag='h'

The flag parameter is used to filter articles based on special markers assigned to them. The value 'h' specifically stands for "Headline".

How to assign the 'h' flag to an article:

  1. Log in to your DedeCMS 后台 (backend/admin panel).
  2. Go to "Content" -> "Add Article" ( -> 添加文档) or edit an existing article.
  3. On the article editing page, look for the "Options" (选项) section, usually on the right side.
  4. Find the "Flags" (推荐位) field. It's often a set of checkboxes or a dropdown.
  5. Check the box for "Headline" (头条). The system internally uses the letter 'h' for this.
  6. Save the article.

Now, any article with this "Headline" flag will be included in the results of {dede:arclist flag='h'}.


Common Usage Examples

Here are a few practical examples of how you would use this tag in your HTML/PHP template files (e.g., index.htm).

{dede:arclist flag=h'
(图片来源网络,侵删)

Example 1: Simple Headline List

This will display the titles of the 5 most recent articles marked as headlines.

<h2>Latest Headlines</h2>
<ul>
  {dede:arclist flag='h' row='5' titlelen='50'}
  <li>
    <a href="[field:arcurl/]">[field:title/]</a>
  </li>
  {/dede:arclist}
</ul>

Explanation of fields used:

  • [field:arcurl/]: The full URL to the article.
  • `[field:title/]: The title of the article.

Example 2: Headlines with Images and Summaries

This is a more common and visually appealing layout for headlines.

<div class="headline-section">
  {dede:arclist flag='h' row='3' titlelen='40' infolen='120' imgwidth='200' imgheight='150'}
    <div class="headline-item">
      <!-- Display the article's thumbnail image -->
      <a href="[field:arcurl/]">
        <img src="[field:litpic/]" alt="[field:title/]" width="200" height="150" />
      </a>
      <!-- Display the title and summary -->
      <h3><a href="[field:arcurl/]">[field:title/]</a></h3>
      <p>[field:info/]...</p>
      <!-- Display other info like date and clicks -->
      <span class="post-info">Date: [field:pubdate function="MyDate('Y-m-d', @me)'/] | Views: [field:click/]</span>
    </div>
  {/dede:arclist}
</div>

Explanation of additional fields used:

  • [field:litpic/]: The URL of the article's thumbnail image (the "little picture").
  • [field:info/]: The summary or introductory text of the article.
  • [field:pubdate/]: The publication date of the article. We use a function to format it.
  • [field:click/]: The number of times the article has been viewed.

Other flag Values

The flag parameter can accept multiple values at once, separated by commas (e.g., flag='h,c'). Here are the most common flags:

Flag Value Name in Admin Panel Description
h 头条 (Headline) Main, top-priority news.
c 推荐 (Recommend) Editor's pick or recommended content.
p 图片 (Picture) An article that features an image as its main focus.
j 加粗 (Bold) The title should be displayed in bold.
a 幻灯 (Slide) An article intended for a homepage slideshow/banner.
s 滚动 (Scrolling) An article for a scrolling news ticker.

Example: Displaying Headlines and Recommended Articles

{dede:arclist flag='h,c' row='8' titlelen='30'}
  <a href="[field:arcurl/]">[field:title/]</a>
{/dede:arclist}

Summary

Tag {dede:arclist flag='h'}
Purpose To fetch a list of articles manually marked as "Headlines" in the DedeCMS backend.
Key Parameter flag='h'
How to Use Place it inside your HTML template files (.htm) and wrap it in {dede:arclist}...{/dede:arclist}. Use fields like [field:title/] and [field:arcurl/] to display the data.
Common Use Case Displaying a "Top Stories" or "Breaking News" section on a website's homepage.
-- 展开阅读全文 --
头像
Win7织梦出现unexpected error怎么办?
« 上一篇 11-27
dede likearticleyuanli
下一篇 » 11-27

相关文章

取消
微信二维码
支付宝二维码

目录[+]