Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Discuz modifies the character length limit of article titles

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how Discuz modifies the character length limit of the title of the article, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.

I. Environment

Discuz 3.4

II. Change the method

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

It is a good idea to back up the database before executing the sql statement:

# mysqldump-u root-p Discuz > Discuz.sql

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

Log in to mysql:

# mysql-u root-p

(if the root account of mysql does not have a password, enter directly when prompted for the password. )

Switch to the database used by Discuz:

MariaDB [(none)] > use Discuz

Execute the following 3 sql statements, which are modified to a limit of 180 characters:

MariaDB [Discuz] > ALTER TABLE `pre_forum_ post` CHANGE `account`roomt` VARCHAR (180) NOT NULL;MariaDB [Discuz] > ALTER TABLE `pre_forum_ rsscache`CHANGE `Secrett`Secrett` char (180) NOT NULL;MariaDB [Discuz] > ALTER TABLE `pre_forum_ thread`CHANGE `roomt`Secrett` char (180) NOT NULL

Note: MariaDB [Discuz] > is the prompt, do not enter it when entering sql statements.

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

# cp website directory / static/js/forum_post.js website directory / static/js/forum_post.js_bak

Change the contents of the forum_post.js file

# vi website directory / static/js/forum_post.js

The following characters were found

Else if (mb_strlen (theform.subject.value) > 180) {showError ('your title exceeds the limit of 180 characters'); return false

Change 80 to 180 (the red character). Save the file and exit.

Modify the number of JS authentication characters and back up the file:

# cp website directory / static/js/forum.js website directory / static/js/forum.js_bak

Edit the forum.js file:

# vi website directory / static/js/forum.js

The following was found:

Theform.message.focus ();} else if (mb_strlen (theform.subject.value) > 180) {s = 'your title exceeds the limit of 180 characters'; theform.subject.focus ()

Change 80 to 180 (the red character). Save the file and exit.

To modify the limited number of characters in the template, back up the file first:

# cp website directory / template/default/forum/post_editor_extra.htm website directory / template/default/forum/post_editor_extra.htm_bak

Edit the post_editor_extra.htm file:

# vi website directory / template/default/forum/post_editor_extra.htm

Replace all 80 for 180, save the file, and exit.

Modify the limited number of characters in the template and back up the file:

# cp website directory / template/default/forum/forumdisplay_fastpost.htm website directory / template/default/forum/forumdisplay_fastpost.htm_bak

Edit the forumdisplay_fastpost.htm file:

# vi website directory / template/default/forum/forumdisplay_fastpost.htm

Replace all 80 for 180, save the file, and exit.

Modify the function verification prompt to back up the file:

# cp website directory / source/function/function_post.php website directory / source/function/function_post.php_bak

Edit the function_post.php file:

# vi website directory / source/function/function_post.php

The following characters were found:

If (dstrlen ($subject) > 180) {return 'post_subject_toolong'

Change 80 to 180 (the red character). Save the file and exit.

Find the language pack prompt text and back up the file:

# cp website directory / source/language/lang_message.php website directory / source/language/lang_message.php_bak

Edit the lang_message.php file:

# vi website directory / source/language/lang_message.php

The following was found:

'post_subject_toolong' = >' Sorry, your title is more than 180 characters to modify the title length', change 80 to 180 (red characters). Save the file and exit.

Open the Discuz home page and log in as administrator (admin). Click the Administration Center at the top right of the page:

Enter the administrator's account password, enter the admin center, and click tools-Update Cache-OK. As shown in the following figure:

Then restart the browser and it will take effect.

The above is all the content of the article "how to modify the character length limit of the title of the article by Discuz". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 291

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report