News:

Wondering if this will always be free?  See why free is better.

Main Menu

How to increase the Subject length

Started by Pawan, January 11, 2010, 11:58:07 PM

Previous topic - Next topic

Pawan

How to increase the Subject length in SMF RC2

shadow82x

What specially do you want to change here? Mind attaching a screenshot?
Colin B
Former Spammer, Customize, & Support Team Member


hadesflames

Do you mean the length of the text box, or the length of the amount of characters allowed in the subject?

Pawan

Length of the amount of characters allowed in the subject?

hadesflames

I guess you just want to increase the size of the text box =]

Go to ./Themes/{your_theme}/Post.template.php

search for "// Now show the subject box for this post." then look at <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />

and change the size="80" to the size you want for the box.

SoLoGHoST

#6
Ok, there are currently a max of 255 characters in length for this.  If you want more, you'll have to change (in the SMF messages table) the subject column type from varchar to text.  Since varchar only supports up to 255 character lengths.  So change this to a text field, and than in Subs-Post.php look within the createPost function, change string-255 within the insert (in createPost), where ### = the number of character length you'd like.

Good Luck,
Solomon

EDIT:  Out of all of the mods that there are for SMF, I wouldn't be surprised if there was 1 that already did this.

Jade Elizabeth

Quote from: SoLoGHoST on January 12, 2010, 12:50:04 AM
Ok, there are currently 255 character length.  If you want more, you'll have to change (in the SMF messages table) the subject column type from varchar to text.  Since varchar only supports up to 255 character lengths.  So change this to a text field, and than in Subs-Post.php look within the createPost and modifyPost functions, change string-255 within the insert (in createPost) and update (in modifyPost) queries to string-###, where ### = the number of character length you'd like.

Good Luck,
Solomon


Last time I checked that was the database size. The max you could enter in the field was 80 I believe. I personally had issues and had to go into the template to edit it.

I cannot for the life of me remember what it was....and I edited RC1.2 not RC2. I think that's the issue here too :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

hadesflames

Well, next to size in the input field I described above, there is the maxsize option, which can be changed too. Although I'm not sure if there are any javascript checks for the max length (most likely are) so you might have to do some searching in the JS too.

SoLoGHoST

#9
I'm sorry, my bad, go in Post.php.

FIND:
// Make sure the subject isn't too long - taking into account special characters.
if ($smcFunc['strlen']($form_subject) > 100)
$form_subject = $smcFunc['substr']($form_subject, 0, 100);


AND FIND:
// At this point, we want to make sure the subject isn't too long.
if ($smcFunc['strlen']($_POST['subject']) > 100)
$_POST['subject'] = $smcFunc['substr']($_POST['subject'], 0, 100);


Change 100 in both of these searches up to 255 characters.  If you want more than 255, than change the subject column in messages table from varchar to text.  If you do want more than 255 characters, than you'll need to make the edit to Subs-Post in the createPost function that I mentioned, otherwise, if it's <= 255 character length, don't bother with this edit in Subs-Post.php.

Pawan

I counted the subject field length it is 80 charr only so which file to edit Post.php. or Post.template.php

SoLoGHoST

And also, don't forget in Post.template.php to change the maxlength="80" in here to the maximum number of character length you want:

<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />

SoLoGHoST

Quote from: pawan2002 on January 12, 2010, 01:12:34 AM
I counted the subject field length it is 80 charr only so which file to edit Post.php. or Post.template.php

You need to edit both.

Pawan

I changed in  Post.template.php to 150 char and it is working fine without editing Post.php.
Should i edit it or not as forum is working fine.

SoLoGHoST

#14
Quote from: pawan2002 on January 12, 2010, 01:25:07 AM
I changed in  Post.template.php to 150 char and it is working fine without editing Post.php.
Should i edit it or not as forum is working fine.
If you don't do the edits in Post.php, it will only grab the first 100 characters from the subject that you type in.  So it's up to you really.

P.S. -> Please Mark Topic Solved if you are satisfied with the help in here.  Thanks :)


SoLoGHoST

You're welcome and sorry bout the other post.  Was thinking too far ahead there as I've got a million and 1 things on my mind right now :-[

Pawan

No prob man Making mistake is human nature ,,just take good sleep. :D

Gà Mái

thanks, mark to find later when i need ^^
-- I love SMF --

Advertisement: