Slash Open Source Project

Title    How to Allow Longer Subjects?
Date    Saturday August 30 2003, @02:34PM
Author    jamiemccarthy

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.

© Copyright 2012 - Me, All Rights Reserved

printed from Slashcode, How to Allow Longer Subjects? on 2012-02-07 03:10:46