Nov 14, 2000, 4:55 AM
Enthusiast (706 posts)
Nov 14, 2000, 4:55 AM
Post #2 of 5
Views: 3658
Regan,
If you've only got a few links you can do it manually:
• Add the new category names (keep them handy to paste into the links you want to modify)
• Search for the links in the categories you are changing and modify them to the new category names
• Remove the old category names (and the physical files/directories on your server)
• Re-build
If you've got a lot of links to modify you'll probably find it quicker to do with mysql but I'm not sure what the statement should be so maybe someone else can come in here ...
All the best
Shaun
If you've only got a few links you can do it manually:
• Add the new category names (keep them handy to paste into the links you want to modify)
• Search for the links in the categories you are changing and modify them to the new category names
• Remove the old category names (and the physical files/directories on your server)
• Re-build
If you've got a lot of links to modify you'll probably find it quicker to do with mysql but I'm not sure what the statement should be so maybe someone else can come in here ...
All the best
Shaun
Nov 14, 2000, 1:11 PM
Veteran (1264 posts)
Nov 14, 2000, 1:11 PM
Post #4 of 5
Views: 3635
If the category name is longer than:
Sports A-E
eg:
Sports A-E/Camping & Tramping/Reference & Recources
will the command you've given:
UPDATE tablename SET Category='Sports & Recreation A-E' WHERE Category='Sports A-E';
alter the name and keep the full path, or would it truncate it back to be:
Sports A-E
Sorry if thas a stupid question.
Regan.
Sports A-E
eg:
Sports A-E/Camping & Tramping/Reference & Recources
will the command you've given:
UPDATE tablename SET Category='Sports & Recreation A-E' WHERE Category='Sports A-E';
alter the name and keep the full path, or would it truncate it back to be:
Sports A-E
Sorry if thas a stupid question.
Regan.
Nov 14, 2000, 3:55 PM
User (63 posts)
Nov 14, 2000, 3:55 PM
Post #5 of 5
Views: 3624
I give you a piece of code I use for something quite similar.. (move an entire subtree from a location to another)
hope that helps...
my $name = pop @subs;
$move_subcat_to ? ($move_subcat_to .= "/$name") : ($move_subcat_to = "$name");
$query = qq! UPDATE Category
SET Name = REPLACE(Name,'$move_subcat_from','$move_subcat_to')
WHERE Name LIKE '$move_subcat_from/%' or
Name = '$move_subcat_from'
!;
$result = $db->do ($query);
ciao
lepo
Lepo - lepo@lepo.org
hope that helps...
Code:
my @subs = split("\/", $move_subcat_from); my $name = pop @subs;
$move_subcat_to ? ($move_subcat_to .= "/$name") : ($move_subcat_to = "$name");
$query = qq! UPDATE Category
SET Name = REPLACE(Name,'$move_subcat_from','$move_subcat_to')
WHERE Name LIKE '$move_subcat_from/%' or
Name = '$move_subcat_from'
!;
$result = $db->do ($query);
ciao
lepo
Lepo - lepo@lepo.org