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

别人写的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
    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
    Explain the concept of session locking.Explain the concept of session locking.Apr 29, 2025 am 12:39 AM

    Sessionlockingisatechniqueusedtoensureauser'ssessionremainsexclusivetooneuseratatime.Itiscrucialforpreventingdatacorruptionandsecuritybreachesinmulti-userapplications.Sessionlockingisimplementedusingserver-sidelockingmechanisms,suchasReentrantLockinJ

    Are there any alternatives to PHP sessions?Are there any alternatives to PHP sessions?Apr 29, 2025 am 12:36 AM

    Alternatives to PHP sessions include Cookies, Token-based Authentication, Database-based Sessions, and Redis/Memcached. 1.Cookies manage sessions by storing data on the client, which is simple but low in security. 2.Token-based Authentication uses tokens to verify users, which is highly secure but requires additional logic. 3.Database-basedSessions stores data in the database, which has good scalability but may affect performance. 4. Redis/Memcached uses distributed cache to improve performance and scalability, but requires additional matching

    What is the full form of PHP?What is the full form of PHP?Apr 28, 2025 pm 04:58 PM

    The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

    How does PHP handle form data?How does PHP handle form data?Apr 28, 2025 pm 04:57 PM

    PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

    What is the difference between PHP and ASP.NET?What is the difference between PHP and ASP.NET?Apr 28, 2025 pm 04:56 PM

    The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

    Is PHP a case-sensitive language?Is PHP a case-sensitive language?Apr 28, 2025 pm 04:55 PM

    PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

    How do you redirect a page in PHP?How do you redirect a page in PHP?Apr 28, 2025 pm 04:54 PM

    The article discusses various methods for page redirection in PHP, focusing on the header() function and addressing common issues like "headers already sent" errors.

    Explain type hinting in PHPExplain type hinting in PHPApr 28, 2025 pm 04:52 PM

    Article discusses type hinting in PHP, a feature for specifying expected data types in functions. Main issue is improving code quality and readability through type enforcement.

    See all articles

    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

    MantisBT

    MantisBT

    Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    SecLists

    SecLists

    SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.