Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-07-28 03:33:45

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: Changing case from UPPERCASE to Title Case for certain feilds

Thanks again, Joe!

I’m not handy with SQL at all, but I finally found a method that worked:

  1. Export the table as a text file in .sql format.
  2. Open the file in Textmate (which I already had handy).
  3. Select the rows with UPPERCASE data.
  4. Choose “Convert” from the “Text” menu, and select “to Titlecase”.
  5. Find and replace each instance of 'Article', 'Root' with the correct lowercase values.
  6. Find and replace each instance of INSERT INTO `Txp_Category` (`Col1`, `Col2`, `Etc`, ...) VALUES with the correct lowercase values.
  7. Import the table back into the database.
  8. Use UPDATE txp_category SET name=LOWER(name); to reset lowercase values for the columns that should be lowercase (i.e. category names).

This method is a bit too messy for the textpattern table, but the Category1 and Category2 columns were easy to update using another query:

UPDATE textpattern SET Category1=LOWER(Category1);
UPDATE textpattern SET Category2=LOWER(Category2);

For the title data, I’d be willing to use something like cnn_title_case.

Thanks for your guidance and support!

Last edited by johnstephens (2009-07-28 03:42:44)

Offline

Board footer

Powered by FluxBB