Home Backend Development PHP Tutorial 别人写的PHP的CMS都是用很短的语句控制文章怎么实现

别人写的PHP的CMS都是用很短的语句控制文章怎么实现

Jun 13, 2016 am 10:06 AM
quot

别人写的PHP的CMS都是用很短的语句控制文章如何实现
我用过dedecms 他里面的功能是这样的。比如我要调用某个项目里面的 最新更新的10个文章我就可以这样。
{dede:imt xx xx xx } 然后这样就调用出来了。他没有直接查询mysql吗?如何才能坐到这样 给个思路呢?

------解决方案--------------------
标签名称:arclist
标记简介:织梦常用标记,也称为自由列表标记,其中imglist、imginfolist、specart、coolart、autolist都是由该标记所定义的不同属性延伸出来的别名标记。
功能说明:获取指定文档列表
适用范围:全局使用
基本语法:
{dede:arclist flag='h' typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword='' limit='0,1'}
[field:title/]
{/dede:arclist}
 typeid='' 栏目ID,在列表模板和档案模板中一般不需要指定,在首页模板中允许用","分开表示多个栏目;

 orderby='sortrank' 文档排序方式
§ orderby='hot' 或 orderby='click' 表示按点击数排列
§ orderby='sortrank' 或 orderby='pubdate' 按出版时间排列
§ orderby='near'
§ orderby=='lastpost' 按最后评论时间
§ orderby=='scores' 按得分排序
§ orderby='id' 按文章ID排序
§ orderby='rand' 随机获得指定条件的文档列表 

 idlist ='' 提取特定文档(文档ID) 调用指定id文档 例子idlist ='4,45,78,237'
 limit='起始ID,记录数' (起始ID从0开始)表示限定的记录范围(如:limit='1,2' 表示从ID为1的记录开始,取2条记录)
 keyword='' 含有指定关键字的文档列表,多个关键字用","分
 orderway='desc' 值为 desc 或 asc ,指定排序方式是降序还是顺向排序,默认为降序

使用实例
调用推荐文章
{dede:arclist flag="c" channelid='' row='10' titlelen='60' orderby=''}

  • [field:title /]

  • {/dede:arclist}
    row='10' 调用10条, titlelen='60'标题长度为30汉字 flag="c" 推荐文章 orderby='' 默认为按发布时间排序
    flag = 'c' 自定义属性值:头条[h] 推荐[c] 图片[p] 幻灯[f] 滚动[s] 跳转[j] 图文[a] 加粗


    调用最新文章按发布时间排序
    {dede:arclist channelid='' row='10' titlelen='60'}
  • [field:title /]

  • {/dede:arclist} row='10' 调用10条, titlelen='60'标题长度为30汉字

     按ID排序降序排列,从大到小
     {dede:arclist channelid='' row='10' titlelen='60' orderby='id' }
  • [field:title /]

  • {/dede:arclist} row='10' 调用10条, titlelen='60'标题长度为30汉字 orderby='id' 按ID,降序排列

     按ID排序顺序排列,从小到大
     {dede:arclist channelid='' row='10' titlelen='60' orderby='id' orderway='asc' }
  • [field:title /]

  • {/dede:arclist} row='10' 调用10条, titlelen='60'标题长度为30汉字 orderby='id' 按ID,orderway='desc' 值为 desc 或 asc ,指定排序方式是降序还是顺向排序,默认为降序


    调用含有缩图的文档
    {dede:arclist flag="p" row='10' titlelen='60'}
  • [field:fulltitle /]
    [field:title /]

  • {/dede:arclist} flag = 'p' 自定义属性值:头条[h] 推荐[c] 图片[p] 幻灯[f] 滚动[s] 跳转[j] 图文[a] 加粗

     日期的各种格式
    08 [field:pubdate function=strftime('%d',@me)/]
    08 日 [field:pubdate function=strftime('%d日',@me)/]
    06-08 [field:pubdate function=strftime('%m-%d',@me)/]
    06月08日 [field:pubdate function=strftime('%m月%d日',@me)/]
    09-06-08 [field:pubdate function=strftime('%y-%m-%d',@me)/]
    2009-06-08 [field:pubdate function=strftime('%Y-%m-%d',@me)/]
    09年06月08日 [field:pubdate function=strftime('%y年%m月%d日',@me)/]
    2009年06月08日 [field:pubdate function=strftime('%Y年%m月%d日',@me)/]
    2009-06-08 13:28 [field:pubdate function=strftime('%Y-%m-%d %H:%M',@me)/]
    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

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

    JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

    How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

    Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

    How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

    How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

    Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

    The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

    How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

    How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

    Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

    Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

    How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

    Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

    See all articles