Help - Search - Members - Calendar
Full Version: 3.3 Brings Global Scope Dirify Of Subcategories?
Movable Type Community Forum > Using Movable Type > Entries and Archives
ahains
Given:
->Entries with title "MyTitle"
->in a category of ParentCategory\SubCategory, where Subcategory was obviously a subcategory of ParentCategory
->and an individual entry archive with naming of category/sub_category/entry_basename.php
-Note that I have several top level categories, each of them containing a subcategory of the same name 'SubCategory'.

Previously publishing this would give me a file output of:
.../ParentCategory/SubCategory/MyTitle.php
.../NextParentCategory/SubCategory/MyTitle.php
.../N-ParentCategory/SubCategory/MyTitle.php

After upgrading to 3.3, I get dir names that are dirified as though to prevent collisions (even though subcategories are under other top level categories, so no collision exists) appended like:
.../ParentCategory/SubCategory_1/MyTitle.php
.../NextParentCategory/SubCategory_2/MyTitle.php
.../N-ParentCategory/SubCategory_N/MyTitle.php

Was this an intentional change?
It's rather unlivable for me as I need the SubCategory dir to be named SubCategory.
Any suggestions?
Su-
Edit the category basenames.
ahains
QUOTE (Su- @ Oct 12 2006, 07:11 PM) *
Edit the category basenames.


Thanks for the tip on the workaround, this does fix existing subcategories.
That does leave me with the issue of having to fix every new subcategory after the fact.

Database hacks are usually a bad idea as you'll forget what you did and stuff may break on future versions, but that's what I did anyhow smile.gif

First I tried an insert trigger that would set the basename equal to the lower case version of the category label. It only does this if two conditions are met - (1)the category is not top level and (2)the category label has no other dirification needs (e.g. "sub cat" would be "sub_cat", so it doesn't change in this case). These cases meet my needs, but probably wouldn't for others.

Anyway, this insert trigger did not work:
delimiter |
CREATE TRIGGER on_mt_category_insert_fix_subcategory
BEFORE INSERT ON mt_category
FOR EACH ROW BEGIN
IF NEW.category_parent > 0 AND NEW.category_basename LIKE CONCAT(NEW.category_label, '%') THEN
SET NEW.category_basename = LOWER(NEW.category_label);
END IF;
END|
delimiter ;


So I tried an update trigger and this did work, as apparently creating a new subcategory sets some/all of the properties with an update or possibly replace statement).
delimiter |
CREATE TRIGGER on_mt_category_update_fix_subcategory
BEFORE UPDATE ON mt_category
FOR EACH ROW BEGIN
IF NEW.category_parent > 0 AND NEW.category_basename LIKE CONCAT(NEW.category_label, '%') THEN
SET NEW.category_basename = LOWER(NEW.category_label);
END IF;
END|
delimiter ;


Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.