Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Article Poll

Poll I found this article to be
Very Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:3

How to Allow Longer Subjects?

posted by jamiemccarthy on 02:34 PM August 30th, 2003   Printer-friendly   Email story
An anonymous reader asks: "By default there is a limit on how long a poster's subject can be. Is there a way to get beyond this limitation, so that the subject lines for comments and stories can be longer?" Sure, it's easy... this is a good introduction to using MySQL to customize Slash.

I assume "poster's subject" refers to the subject field for comments.

The first step is to increase the size in the database. Right now, a DESCRIBE comments will show you that the max size, as we ship the code, is 50. To bump that to 100 in the table, open up your MySQL client with mysql -u username databasename (add -p if you have a password). Then: ALTER TABLE comments CHANGE COLUMN subject subject VARCHAR(100) NOT NULL DEFAULT ''

(If you wanted to change the VARCHAR size, but forgot the syntax and settings for NOT NULL and DEFAULT, a SHOW CREATE TABLE comments will remind you.)

I haven't actually tried it, but I just looked over the code to see if we truncate the comment subject in perl before inserting it into the DB. It looks like we do not -- that we just let the DB truncate if necessary. Which is good. So the ALTER TABLE should be the only command necessary!

As for stories, it looks like we ship stories.title as a VARCHAR(100) -- you can probably guess now how to increate that limitation too.

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login
Loading... please wait.