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

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    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)

    Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

    Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

    cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

    The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

    Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

    Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

    12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

    Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

    Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

    Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

    PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

    PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

    How to Register and Use Laravel Service Providers How to Register and Use Laravel Service Providers Mar 07, 2025 am 01:18 AM

    Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

    Customizing/Extending Frameworks: How to add custom functionality. Customizing/Extending Frameworks: How to add custom functionality. Mar 28, 2025 pm 05:12 PM

    The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

    See all articles