dedecms系统文章调用描述的字数字数最多为250个字节,文章摘要(能够通过infolen或description相关标签调用)被设置了字数上 限为250字符,设置上限的次要目的是减少数据库的冗余,包管网坐优良的性能。因而,如果对简介内容不设置上限明显不合理,但是如果能够自正在控制这一上 限,dedecms仿站那么将对网页内容布局带来积极做用。正在网页设想过程中,NET源代码。dedecms往往需要正在频道列表页面调用到 文章摘要,如果能够无效控制文章摘要的字数,那么就能够使得页面布局很灵活。
下面我们先来说如何修改这一上限值,就能够表现出[field:description function="cn_substr(@me,字符数)"/]这一方式的主要性。
在Dedecms系统中取文章摘要相关的php文件次要有:
/dede/archives_add.php /dede/archives_edit.php /dede/article_add.php /dede/article_edit.php /dede/article_description_main.php
正在add页面,有一句话是:
$description = cn_substrR($description,$cfg_auot_description); , 这句话实现了[field:description function="cn_substr(@me,字符数)"/]
这一功能。由于这一语句确实有益于页面布局,因而我们正在尝试中没有修改。
正在edit页面,有一句话是:$description = cn_substrR($description,250); ,这句话中呈现了一个熟悉的字符数250,这就是系统设置的文章摘要字符数的上限值。 如果是gbk编码则显示出来的就是125个字。如果是utf-8编码则是81个字。明显,我们冲要破文章摘要字符数上限,必定得拿它开刀了。是的,这里修 改250为其他值即可,例如500。这里不保举设置得过高,一个是正在列表页没必要展现太多内容(展现太多内容不如间接用body了),另一个是避免数据 库产生冗余。
完成上面的修改还不敷,还需要修改article_description_main.php
正 在article_description_main.php页面,找到if($dsize>250) $dsize = 250;语句,这里限制了正在后台从动获取摘要的字符数。把这里的250修改为500即可,织梦仿站也就是和之前修改的字符数分歧即可。(如果你确认你的 每一条文章都是手动添加,手动完成摘要获取就不需要修改这个文件了。从动摘要获取次要还是给大量文章和采集预备的。)
最初,登录后台,正在系统-系统基本参数-其它选项中,从动摘要长度,改成500即可,也就是和之前修改的字符数分歧即可。
完成上述修改后,我们再到频道列表页,通过标签调用即可,示例标签如下:
{dede:list typeid=” row=’5′ titlelen=’100′ orderby=’new’ pagesize=’5′} <h3><a href=’[field:arcurl/]‘>[field:title/]</a></h3> <p>[field:description function='cn_substr(@me,500)'/]…</p> {/dede:list}
通过以上方式,我们就实现了调用的文章摘要字符为500字符,完全冲破了文章摘要250字符的系统限制,为网页布局提供了愈加广阔的空间。
下说我们也来说说下常的Dedecms文章或列表页调用文章摘要方法
1:[field:info /] 2:[field:description /] 3:[field:info function="cn_substr(@me,字符数)"/] 4:[field:description function="cn_substr(@me,字符数)"/]
第1、2种方法是间接调用文章摘要,正在调用的字数问题上,当使用[field:info /]时,能够正在{dede:arclist infolen=’ ‘ }{/dede:arclist}中,设置调用摘要的字符数(最高可设置为系统设置的250);如果使用[field:description /],则间接使用后台设置的摘要字符上限(后台也有上限250个字符)。明显这两种方式都很被动灵活性太差。
第3、4种方法通过function函数实现了对文章摘要显示字符的灵活调整。当然正常没有修改文章摘要内容字符上限时,这4个方法的差别并不大。
=========================
1:[field:info /] 2:[field:description /] 3:[field:info function="cn_substr(@me,字符数)"/] 4:[field:description function="cn_substr(@me,字符数)"/]
这四种方法来调用文章描述标签。但最多也只能调用前面250个字符。如果要调用更多需要修改几个地方:
1.article_description_main.php页面,找到"if($dsize>250) $dsize = 250;"语句把250修改为500
2.登录后台,在系统-系统基本参数-其它选项中,自动摘要长度,改成500.
3.登录后台,执行SQL语句:alter table `dede_archives` change `description` `description` varchar( 1000 )
调用标签{dede:field.description function='cn_substr(@me,500)'/}.就可以显示500个字符了
以上就是织梦dedecms系统修改文章描述调用字数的方法的内容,更多相关内容请关注PHP中文网(www.php.cn)!

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

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.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft