Page 1 of 1

subject line

Posted: Thu Mar 18, 2010 12:08 am
by chimp77
Is there a way to adjust the number of characters in the thread subject line? I noticed that there is a limit of how long a subject line can be.

Re: subject line

Posted: Thu Mar 18, 2010 2:06 am
by Tom
If you're using a prosilver-based style, open the file styles/prosilver/template/posting_editor.html and find this line:

Code: Select all

		<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>
You will see the numbers 60 and 64 in between conditional tags. 60 is the subject line limit when posting a new topic or sending a new PM, and 64 is the subject line limit when posting a reply to a topic or a PM (4 characters difference for the "Re: " in front of the original subject title in replies). Change those numbers to whatever you'd like, then save the file to complete the changes.

Keep in mind, however, that the maximum character length for the subject line cannot exceed 255 characters, even if you set the numbers above 255 in the code I told you to find. This is due to the fact that the subject field in the database has a maxlength of 255 characters. Therefore, if you make the length longer than 255 in that file, only the first 255 of the characters in the subject will be submitted to the database. Just informing you of this beforehand.

Re: subject line

Posted: Thu Mar 18, 2010 12:19 pm
by chimp77
Thanks Tom, I am using sub silver 2. I found a quick reply editor where I saw the "64" characters for the "re: ". There was not a posting editor? Any idea what that is named in subsilver2?

thank you!

Re: subject line

Posted: Thu Mar 18, 2010 7:20 pm
by Tom
For subsilver2, open the file styles/subsilver2/template/posting_body.html and find the following line:

Code: Select all

	<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>
That is where you can change the subject length for subsilver2. The same 60 and 64 are present there, just in a different context.

Re: subject line

Posted: Sun Apr 18, 2010 3:54 pm
by hostsdepot
Thank you. It is very useful.

Re: subject line

Posted: Mon Apr 19, 2010 8:54 pm
by hostsdepot
Thanks for the instruction and remember to clear cache file to make it work.

Thanks

Re: subject line

Posted: Mon Apr 19, 2010 9:00 pm
by Green Light
Did you purge the cache?
Purge the cache
Purge all cache related items, this includes any cached template files or queries.
In, ACP >> Index

edit: guess you figured it out, right when i posted.

Re: subject line

Posted: Thu Aug 19, 2010 8:46 pm
by bawdyn
I made these changes and it did allow me to type in a longer Subject line, but it still truncated it at 60 characters when it stored it to the database. I did the cache purge. So, there must be some other place where this character limit is enforced. I'll look for it, but if anyone has found it already I'd appreciate the info. Thanks.

Re: subject line

Posted: Thu Aug 19, 2010 9:15 pm
by bawdyn
OK, I found it.

File: includes\functions_posting.php
Line: $subject = truncate_string($subject);
Change to: $subject = truncate_string($subject, 251);

251 is the maximum value as you need room for the 're: ' characters for a reply. Use the smaller of the two numbers you set in the Template. The truncate_string function defaults to 60 characters if you don't add the additional parameter.

Re: subject line

Posted: Tue Dec 07, 2010 7:28 pm
by RiTz21
Are these changes 'loss' if you update your version of PHPBB using the automatic updater?

RiTz21

Re: subject line

Posted: Wed Dec 08, 2010 7:19 pm
by Tom
RiTz21 wrote:Are these changes 'loss' if you update your version of PHPBB using the automatic updater?
No, these changes should not be lost if you update using the automatic updater.

Re: subject line

Posted: Fri Dec 10, 2010 2:12 pm
by RiTz21
Ok I have applied the two changes to my Forum to allow for 124/128 characters, and it works like a charm!!

My Thanks to Tom & bawdyn for sharing their knowledge of this!!

RiTz21

Re: subject line

Posted: Sun Dec 12, 2010 1:46 pm
by Tony Stark
i'm confused by this. i replaced 60 and 64 with 251 and 255, and i put 251 after truncate subject, but when i tested it out by typing in a really long subject line, i managed to get only as far as 251 before getting stopped. i thought the 251 limit was only for replies, to make way for "re: ", but that if it was a new subject, it could be 255 in the line.

Re: subject line

Posted: Sun Dec 12, 2010 3:34 pm
by RiTz21
Tony Stark wrote:i'm confused by this. i replaced 60 and 64 with 251 and 255, and i put 251 after truncate subject, but when i tested it out by typing in a really long subject line, i managed to get only as far as 251 before getting stopped. i thought the 251 limit was only for replies, to make way for "re: ", but that if it was a new subject, it could be 255 in the line.
It is the other way around: 251 would be the 'limit" for a normal subject, since a 'reply' to that subject would ADD 4 more characters, requiring 255 characters!!

RiTz21

Re: subject line

Posted: Sun Dec 12, 2010 3:36 pm
by Tony Stark
RiTz21 wrote:
Tony Stark wrote:i'm confused by this. i replaced 60 and 64 with 251 and 255, and i put 251 after truncate subject, but when i tested it out by typing in a really long subject line, i managed to get only as far as 251 before getting stopped. i thought the 251 limit was only for replies, to make way for "re: ", but that if it was a new subject, it could be 255 in the line.
It is the other way around: 251 would be the 'limit" for a normal subject, since a 'reply' to that subject would ADD 4 more characters, requiring 255 characters!!

RiTz21
ah, so 255 after truncate subject then? and does this work for pms too?

EDIT: got it figured out now. in functions_content.php in the includes folder, replace

Code: Select all

function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
with

Code: Select all

function truncate_string($string, $max_length = 251, $max_store_length = 255, $allow_reply = false, $append = '')