موقع الخولي تشانل يرحب بزواره الكرام ويتمني لكم قضاء وقت مفيد لا يغضب الله عز وجل اللهم صلى وسلم وبارك على سيدنا محمد عدد اوراق الاشجار وعدد مياه البحار وعدد ما أظلم عليه الليل وما أضاء عليه النهار .

Increase Subject Length (phpBB 3)

Description of your first forum.

المشرف: مصطفي طارق

أضف رد جديد
ELKHOLYCHANNEL
Site Admin
مشاركات: 21
اشترك في: الأحد مايو 01, 2022 12:56 pm

Increase Subject Length (phpBB 3)

مشاركة بواسطة ELKHOLYCHANNEL »

Increase Subject Length (phpBB 3)
By default, phpBB 3 limits the length of post and topic subjects to 60 characters. In some boards, it is desirable to allow longer subjects, so this is a guide to hacking your phpBB to increase the limit. We will use 120 as the new subject length here, but you can use a different number by simply changing 120 to that number in the instructions that follow.

Before beginning, let me point out some limitations of this guide and the methods we will be using. The maximum subject length allowed by the MySQL database software is 255 characters, and this cannot be exceeded by the methods we will be using (there is a way, which we'll look at later). Other database management software (DBMS) may have different character limits. We will also be using SQL queries to alter the database tables. These queries are written for use in MySQL. If you are using another DBMS, you may need to edit the queries before you can use them. Now, on to the hacking!

There are three steps to increasing the subject length. First, you may need to run a few SQL queries. If you plan to use subject lengths of 100 characters or less, you can skip the queries. They're only needed when going over 100 characters.

You can run the needed queries using a database management utility like phpMyAdmin. If you use phpMyAdmin, you may need to change the phpbb_ prefix of the database table names in these queries. Database Update scripts will handle that automatically.

ALTER TABLE phpbb_posts CHANGE post_subject post_subject varchar(120) DEFAULT '' NOT NULL;
ALTER TABLE phpbb_topics CHANGE topic_title topic_title varchar(120) DEFAULT '' NOT NULL;
ALTER TABLE phpbb_drafts CHANGE draft_subject draft_subject varchar(120) DEFAULT '' NOT NULL;
ALTER TABLE phpbb_forums CHANGE forum_last_post_subject forum_last_post_subject varchar(120) DEFAULT '' NOT NULL;
ALTER TABLE phpbb_privmsgs CHANGE message_subject message_subject varchar(120) DEFAULT '' NOT NULL;
ALTER TABLE phpbb_topics CHANGE topic_last_post_subject topic_last_post_subject varchar(120) DEFAULT '' NOT NULL;
The second step is to prevent phpBB 3 from cutting off the subjects after 60 characters. This requires a small change in includes/functions_posting.php. Locate the following lines in this file.

$subject = truncate_string($subject);
$data['topic_title'] = truncate_string($data['topic_title']);
Replace those lines with these altered versions. Remember to change the 120 on each of these lines if you are using a different length.

$subject = truncate_string($subject, 120);
$data['topic_title'] = truncate_string($data['topic_title'], 120);
The third and final step is to edit the templates installed on your forum so that longer subject can be entered. As you may know, different templates tend to use very different coding. We'll look at both prosilver and subsilver2, but in other styles the lines may be different. If you cannot find these exact lines, try looking for a line containing name="subject" or name='subject'.

First up is prosilver; look for this line in posting_editor.html.

<dd><input type="text" name="subject" id="subject" size="45"
maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->"
tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>
This is the matching line in subsilver2's posting_body.html.

<td class="row2" width="78%"><input class="post" style="width:450px"
type="text" name="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->"
tabindex="2" value="{SUBJECT}" /></td>
In each file, check the line you've located to see if it contains the text maxlength. If you find the line does not contain maxlength, you can skip this step. No edits are required here when there is no maxlength set.

In the two default templates, you can see this:
maxlength="6064"

Note the two numbers in there: 60 and 64. These numbers need to be changed to the length you are using for subjects. The number following S_NEW_MESSAGE (60, here), is changed to your desired length; 120 for the example. The second number is changed to that plus 4, or 124 for the example. Below is a sample of the prosilver line edited in this way.

<dd><input type="text" name="subject" id="subject" size="45"
maxlength="<!-- IF S_NEW_MESSAGE -->120<!-- ELSE -->124<!-- ENDIF -->"
tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>
Now your posters can enter subject lines of greater length when making, editing, or replying to topics.

Allowing More Than 255 Characters
Above, I mentioned before that there is a 255 character limit when changing the allowed subject length with the method described. There is one way to exceed this length, but you must be careful when using it. This alternate method allows subjects that can potentially be much longer, even as long as a full post.

To use this method, you need to run a different set of SQL queries. A third query is included here for private message subjects, which was did not need to be changed with the other method. If you want to keep those at their default limit of 255 characters, skip that query. MySQL users can replace TEXT with TINYTEXT in these queries for shorter (but still very long) subject allowances.

ALTER TABLE phpbb_posts CHANGE post_subject post_subject TEXT NOT NULL;
ALTER TABLE phpbb_topics CHANGE topic_title topic_title TEXT NOT NULL;
Once you have run these queries, the second and third steps of the first method must also be carried out as described above. The number you use in place of 120 in those steps will be the maximum limit of subjects allowed from the posting form. You can use whatever number you wish.

http://www.phpbbsmith.com/increase-subj ... th-phpbb-3
أضف رد جديد