Remove category and all entries
Remove category and all entries
Hello,
how to delete a category and all it's entries? If I click on the delete button next to a category I will be asked where to move the entries of that category.
But I don't want do move the entries, I want to remove the category and all it's entries...
Regards...
how to delete a category and all it's entries? If I click on the delete button next to a category I will be asked where to move the entries of that category.
But I don't want do move the entries, I want to remove the category and all it's entries...
Regards...
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Remove category and all entries
Did you try to move the articles to the "No category" value?
Apart from this, Serendipity in its current state does not delete the entries, as it worships the entries as the most important item on your blog.
I recommend to go to the Edit Entries screen, sort the entries by Category and then delete the entries in that category first, and after that, remove the entries.
Regards,
Garvin
Apart from this, Serendipity in its current state does not delete the entries, as it worships the entries as the most important item on your blog.
I recommend to go to the Edit Entries screen, sort the entries by Category and then delete the entries in that category first, and after that, remove the entries.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
No, I did not try that, it's a production system. I interpret that function in the way that it does not remove the entries, it just move the entries to the "unnamed" category.Did you try to move the articles to the "No category" value?
In the category to be deleted there are several 100s entries. Manually deleting would be a pain.I recommend to go to the Edit Entries screen, sort the entries by Category and then delete the entries in that category first, and after that, remove the entries.
Is there any function like "Delete (or make invisible) all entries in category x"?
Regards
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Nope, I'm sorry. There isn't. For someone with PHP knowledge it would be easy to create such a plugin in less than an hour...
I don't see a large need for such a function, as in the 3 years of s9y development you are the first to request that.
This snippet of SQL code would do the trick on a MySQL 4.1 installation:
And this could be adapted to PHP:
Blogs are usually there to archive content. People writing their diaries/blogs usually never want to delete their past, so Serendipity is built to serve that need and focusses to maintain the entries even when you re-categorize your entries.
Maybe if you tell me the reason you need to delete 100s of entries I can see a real need for this, and think about implementing a plugin. If I don't see the need myself, I still can be bribed to do it...
Regards,
Garvin
I don't see a large need for such a function, as in the 3 years of s9y development you are the first to request that.
This snippet of SQL code would do the trick on a MySQL 4.1 installation:
Code: Select all
DELETE FROM serendipity_entries WHERE id IN (SELECT entryid FROM serendipity_entrycat WHERE categoryid = 4)
Code: Select all
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('serendipity');
$ec = mysql_query("SELECT entryid FROM serendipity_entrycat WHERE categoryid = 4");
while ($row = mysql_fetch_array($ec, MYSQL_ASSOC)) {
mysql_query("DELETE FROM serendipity_entries WHERE id = '{$row['entryid']}'");
echo "Deleted entry #{$row['entryid']}";
}
Maybe if you tell me the reason you need to delete 100s of entries I can see a real need for this, and think about implementing a plugin. If I don't see the need myself, I still can be bribed to do it...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Regular
- Posts: 146
- Joined: Tue Jul 12, 2005 9:12 pm
- Location: Ottawa, Canada
- Contact:
I can think of a few reasons.
[1] replicate an existing blog so you get the same layout and plugins installed. Then you delete the entries and categories and start over.
[2] you have a category that is very popular and you want to make it a blog all by itself. So you essentially want to replicate the blog, delete the category and entry from the original and delete everything except the category from the new
[1] replicate an existing blog so you get the same layout and plugins installed. Then you delete the entries and categories and start over.
[2] you have a category that is very popular and you want to make it a blog all by itself. So you essentially want to replicate the blog, delete the category and entry from the original and delete everything except the category from the new
gw
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
[1] For that you would only migrate the serendipity_config and serendipity_plugins tables, plus your templates/ directory. You wouldn't copy a full blog.
[2] Well, Serendipity is more concepted that you turn a category into its own blog (use different templates depending on the selected category). So you wouldn't need to migrate entries anywhere, as you can keep them.
So you haven't yet convinced me.
Regards,
Garvin
[2] Well, Serendipity is more concepted that you turn a category into its own blog (use different templates depending on the selected category). So you wouldn't need to migrate entries anywhere, as you can keep them.
So you haven't yet convinced me.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Regular
- Posts: 146
- Joined: Tue Jul 12, 2005 9:12 pm
- Location: Ottawa, Canada
- Contact:
if i follow what you are saying about [2] I may not need multiple-blogs for what i am trying to do.
my blogs are lossly connected and seperate at the same time.
say we have categories for apple, oranges and radishes
so a single blog could be about fruit and vegetables . You could have another blog `(using the same articles) about apples and oranges and be called the fruit blog.
if radishes were to become fadish/popular a complete blog about radishes would be called for.
with your suggestion I could write and manage a single blog and "peel-off" blogs based on categories. And because i can put an article in multiple categories any article can now be in multiple blogs.
If this is possible then we are missing an awesome feature. b2evolution does this but i dropped that because the user interface drove me nuts! it was too easy to add a new article and end up publishing to the wrong blog!
another plus is the s9y support of sub-categories. So at anytime you can "peel-off" a category, make it a blog and the sub-categories are now the categories of the new blog.
awesome!
Tell me it's one line of code and it's possible to do in a plugin ....
my blogs are lossly connected and seperate at the same time.
say we have categories for apple, oranges and radishes
so a single blog could be about fruit and vegetables . You could have another blog `(using the same articles) about apples and oranges and be called the fruit blog.
if radishes were to become fadish/popular a complete blog about radishes would be called for.
with your suggestion I could write and manage a single blog and "peel-off" blogs based on categories. And because i can put an article in multiple categories any article can now be in multiple blogs.
If this is possible then we are missing an awesome feature. b2evolution does this but i dropped that because the user interface drove me nuts! it was too easy to add a new article and end up publishing to the wrong blog!
another plus is the s9y support of sub-categories. So at anytime you can "peel-off" a category, make it a blog and the sub-categories are now the categories of the new blog.
awesome!
Tell me it's one line of code and it's possible to do in a plugin ....
gw
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
You could check the categories in your index.tpl like this:
Replace this:
with:
This would output different Stylesheets based on the Categoryid. For this to work you also need to create a "config.inc.php" in your template directory with this content:
because otherwise you can't access the $serendipity global.
A more advanced version of a plugin or a config.inc.php patch can be to modify $serendipity['template'] depending on the selected category. This is pretty starightforward, but I currently don't have time to investigate and document this fully. But I do see it's possible and not very hard.
Regards,
Garvin
Replace this:
Code: Select all
<link rel="stylesheet" type="text/css" href="{$head_link_stylesheet}" />
Code: Select all
{if $serendipity.GET.category == 1}
<link rel="stylesheet" type="text/css" href="http://yourblog/style1.css" />
{else if$serendipity.GET.category == 2}
<link rel="stylesheet" type="text/css" href="http://yourblog/style2.css" />
{else}
<link rel="stylesheet" type="text/css" href="{$head_link_stylesheet}" />
{/if}
Code: Select all
$serendipity['smarty']->assign('serendipity', $serendipity);
A more advanced version of a plugin or a config.inc.php patch can be to modify $serendipity['template'] depending on the selected category. This is pretty starightforward, but I currently don't have time to investigate and document this fully. But I do see it's possible and not very hard.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Regular
- Posts: 146
- Joined: Tue Jul 12, 2005 9:12 pm
- Location: Ottawa, Canada
- Contact:
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
I would create my own categories plugin which only lists the subcategories of a selected blog? So you wouldn't see a link to all other categories...
Regards,
Garvin
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/