Table of Contents
1. Environment" > 1. Environment
Home CMS Tutorial Discuz Let's talk about how Discuz changes the character length limit of post titles.

Let's talk about how Discuz changes the character length limit of post titles.

Jan 19, 2021 pm 07:08 PM
discuz

This article will introduce to you DiscuzHow to modify the character length limit of the post title. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Let's talk about how Discuz changes the character length limit of post titles.

Related recommendations: "discuz Tutorial"

1. Environment

Discuz 3.4

2. Change method

This article limits the character length of the post title to a maximum of 180 characters.

Before executing the sql statement, it is best to back up the database first:

# mysqldump -u root -p Discuz > Discuz.sql
Copy after login

(Discuz represents the database name used by Discuz, and Discuz.sql is the backed up file)

Log in to mysql:

# mysql -u root -p
Copy after login

(If the root account of mysql does not have a password set, just press Enter when prompted to enter the password.)

Switch to the database used by Discuz:

MariaDB [(none)]> use Discuz;
Copy after login

Execute the following three sql statements and modify them to the 180-character limit:

MariaDB [Discuz]> ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(180) NOT NULL;
MariaDB [Discuz]> ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(180) NOT NULL;
MariaDB [Discuz]> ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(180) NOT NULL;
Copy after login

Note: MariaDB [Discuz]> is the prompt. Do not enter it when entering the sql statement.

Modify the number of JS verification characters, back up the file first:

# cp 网站目录/static/js/forum_post.js 网站目录/static/js/forum_post.js_bak
Copy after login

Change the content of forum_post.js file

# vi 网站目录/static/js/forum_post.js
Copy after login

Find the following characters

else if(mb_strlen(theform.subject.value) > 180) {
                showError('您的标题超过 180 个字符的限制');
                return false;
Copy after login

Change 80 into 180 (characters marked in red). Save the file and exit.

Modify the number of JS verification characters, backup file:

# cp 网站目录/static/js/forum.js 网站目录/static/js/forum.js_bak
Copy after login

Edit forum.js file:

# vi 网站目录/static/js/forum.js
Copy after login

Find the following content:

 theform.message.focus();
} else if(mb_strlen(theform.subject.value) > 180) {
        s = '您的标题超过 180 个字符的限制';
        theform.subject.focus();
Copy after login

Change 80 into 180 (characters marked in red). Save the file and exit.

Modify the number of characters in the template, back up the file first:

# cp 网站目录/template/default/forum/post_editor_extra.htm 网站目录/template/default/forum/post_editor_extra.htm_bak
Copy after login

Edit the post_editor_extra.htm file:

# vi 网站目录/template/default/forum/post_editor_extra.htm
Copy after login

Replace all 80s with 180, save the file, and exit.

Modify the character limit in the template, backup file:

# cp 网站目录/template/default/forum/forumdisplay_fastpost.htm 网站目录/template/default/forum/forumdisplay_fastpost.htm_bak
Copy after login

Edit forumdisplay_fastpost.htm file:

# vi 网站目录/template/default/forum/forumdisplay_fastpost.htm
Copy after login

Replace all 80s with 180, save the file, and exit.

Modify function verification prompt, backup file:

# cp 网站目录/source/function/function_post.php 网站目录/source/function/function_post.php_bak
Copy after login

Edit function_post.php file:

# vi 网站目录/source/function/function_post.php
Copy after login

Find the following characters:

if(dstrlen($subject) > 180) {
                return 'post_subject_toolong';
Copy after login

Change 80 to 180 (characters marked in red). Save the file and exit.

Find the language pack prompt text, backup file:

# cp 网站目录/source/language/lang_message.php 网站目录/source/language/lang_message.php_bak
Copy after login

Edit the lang_message.php file:

# vi 网站目录/source/language/lang_message.php
Copy after login

Find the following content:

'post_subject_toolong' => '抱歉,您的标题超过 180 个字符修改标题长度',
把80改成180(标红色的字符)。保存文件,退出。
Copy after login

Open the Discuz homepage , log in as administrator (admin). Click the Management Center in the upper right corner of the page:

Lets talk about how Discuz changes the character length limit of post titles.

Enter the administrator's account and password, enter the Management Center, and click Tools-Update Cache-OK. As shown in the figure below:

Lets talk about how Discuz changes the character length limit of post titles.

# Then restart the browser and it will take effect.

For more programming-related knowledge, please visit: Introduction to Programming! !

The above is the detailed content of Let's talk about how Discuz changes the character length limit of post titles.. For more information, please follow other related articles on the PHP Chinese website!

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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months 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)

Discuz background login problem solution revealed Discuz background login problem solution revealed Mar 03, 2024 am 08:57 AM

The solution to the Discuz background login problem is revealed. Specific code examples are needed. With the rapid development of the Internet, website construction has become more and more common, and Discuz, as a commonly used forum website building system, has been favored by many webmasters. However, precisely because of its powerful functions, sometimes we encounter some problems when using Discuz, such as background login problems. Today, we will reveal the solution to the Discuz background login problem and provide specific code examples. We hope to help those in need.

A must-have for Discuz users! Comprehensive analysis of renaming props! A must-have for Discuz users! Comprehensive analysis of renaming props! Mar 12, 2024 pm 10:15 PM

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

What is Discuz? Definition and function introduction of Discuz What is Discuz? Definition and function introduction of Discuz Mar 03, 2024 am 10:33 AM

"Exploring Discuz: Definition, Functions and Code Examples" With the rapid development of the Internet, community forums have become an important platform for people to obtain information and exchange opinions. Among the many community forum systems, Discuz, as a well-known open source forum software in China, is favored by the majority of website developers and administrators. So, what is Discuz? What functions does it have, and how can it help our website? This article will introduce Discuz in detail and attach specific code examples to help readers learn more about it.

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Mar 03, 2024 am 09:33 AM

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Discuz! It is a very popular forum program that provides users with a platform for convenient communication. Using Discuz! When accessing a forum, sometimes you may encounter an incorrect password, which may cause users to be unable to log in and use the forum normally. Well, meet Discuz! When the password is wrong, how should we quickly solve the problem? Some solutions will be shared below, with specific code examples provided for reference. 1. Check whether the password

Detailed explanation of Discuz registration process: allowing you to easily modify personal information Detailed explanation of Discuz registration process: allowing you to easily modify personal information Mar 13, 2024 pm 12:21 PM

"Detailed Explanation of Discuz Registration Process: Allowing you to easily modify personal information, specific code examples are required" Discuz is a powerful community forum program that is widely used in various websites. It provides a wealth of user registration and personal information modification. functions and interfaces. This article will introduce you to Discuz's registration process in detail and provide specific code examples to help you easily customize and modify your personal information. 1. User registration process In Discuz, user registration is one of the important functions of the site. The smoothness of the registration process and

Solve the problem that Discuz WeChat sharing cannot be displayed Solve the problem that Discuz WeChat sharing cannot be displayed Mar 09, 2024 pm 03:39 PM

Title: To solve the problem that Discuz WeChat shares cannot be displayed, specific code examples are needed. With the development of the mobile Internet, WeChat has become an indispensable part of people's daily lives. In website development, in order to improve user experience and expand website exposure, many websites will integrate WeChat sharing functions, allowing users to easily share website content to Moments or WeChat groups. However, sometimes when using open source forum systems such as Discuz, you will encounter the problem that WeChat shares cannot be displayed, which brings certain difficulties to the user experience.

Detailed explanation of steps to modify Discuz domain name Detailed explanation of steps to modify Discuz domain name Mar 11, 2024 am 11:00 AM

Detailed explanation of the steps to modify the Discuz domain name. Specific code examples are required. With the development and operation of the website, sometimes we need to modify the domain name of the Discuz forum. This may be due to brand change, website SEO optimization, or other reasons. No matter what the reason is, modifying the Discuz domain name is a process that requires careful operation. Today we will introduce the steps of modifying the Discuz domain name in detail and provide specific code examples. Step 1: Back up data. Before modifying the domain name, you must first ensure that the website

Discuz background login failed? Teach you how to solve it easily! Discuz background login failed? Teach you how to solve it easily! Mar 02, 2024 pm 06:03 PM

Discuz background login failed? Teach you how to solve it easily! As Discuz, as a popular forum platform, is widely used in website construction and management, sometimes you will encounter backend login failures, which is troubling. Today we will discuss the issues that may cause Discuz backend login failure, provide some solutions, and attach specific code examples. I hope this article can help webmasters and developers who encounter similar problems. 1. Troubleshooting is to solve the problem of Discuz background login failure.

See all articles