Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv29937
Modified Files:
serendipity_sidebar_items.php
Log Message:
Add sidebar item that shows the category list. See mailing list post for further information.
Index: serendipity_sidebar_items.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_sidebar_items.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- serendipity_sidebar_items.php 25 Aug 2003 16:43:27 -0000 1.26
+++ serendipity_sidebar_items.php 11 Sep 2003 08:30:29 -0000 1.27
@@ -322,5 +322,36 @@
}
}
+class serendipity_categories_plugin extends serendipity_plugin {
+ function introspect(&$propbag) {
+ $propbag->add('name', 'Categories');
+ $propbag->add('description', 'Shows the list of categories.');
+ }
+
+ function generate_content(&$title) {
+ global $serendipity;
+
+ $categories = serendipity_fetchCategories(1);
+ $html = '';
+ $title = 'Categories';
+
+ foreach ($categories as $category) {
+ $category_id = serendipity_makeFilename($category['category_name']);
+
+ $html .= sprintf(
+ '<a href="%s"><img alt="xml" border="0" src="%s"</a> ' .
+ '<a href="%s">%s</a><br />',
+
+ $serendipity['serendipityHTTPPath'] . 'rss.php?category=' . $category_id,
+ $serendipity['serendipityHTTPPath'] . 'xml.gif',
+ $serendipity['serendipityHTTPPath'] . 'categories/' . $category_id,
+ $category['category_name']
+ );
+ }
+
+ print $html;
+ }
+}
+
/* vim: set sts=4 ts=4 expandtab : */
?>
|