Simple PHP Blog

Feeds

If you want to create different RSS feeds for each of your categories, use the c variable in rss.php. For example to see only posts in category number 1 :

blog/rss.php?c=1

You can also put several categories in the feed :

blog/rss.php?c=2,3

There is no native support of comments feed, but you can find a patch here.

Modifications

I use the theme slick, but I have done some changes :

  • Changed the font from Book Antica to Arial in themes/slick/style.css:96
  • Changed the order of sidebar plugins in themes/slick/themes.php
  • Added links to RSS Feeds for each category and comments in themes/slick/themes.php
  • Removed the Search caption in the search plugin in themes/slick/themes.php
  • Add categories in title
themes/slick/themes.php:83
+// Display CATEGORIES
+// This is an array. There can be multiple categories per entry.
+if ( array_key_exists( "categories", $entry_array ) ) {
+    $blog_content  .= ' <font size="-1">{';
+    for ( $i = 0; $i < count( $entry_array[ 'categories' ] ); $i++ ) {
+        $cat_id = $entry_array[ 'categories_id' ][$i];
+        if ( $i > 0 )
+        {
+            if (intval($prev_id/100) != intval($cat_id/100))
+                $blog_content .= ' | ';
+            else
+                $blog_content .= ', ';
+        }
+        $prev_id = $cat_id;
+        $blog_content .= '<a href="index.php?category=' . $cat_id . '">' .
+            $entry_array[ 'categories' ][$i] . '</a>';
+    }
+    $blog_content .= '}</font>';
+}

Some changes in the core too:

  • Changed blog_footer into blog_description at scripts/sb_feed.php:57 for the <description> node because a footer is not a description…
  • Changed some code in order to allow to display sets of categories (index.php?category=2,3,4):
scripts/sb_display.php:116
-$cat_sub_arr = get_sub_categories($category);
-array_push( $cat_sub_arr, $category );
 
+$cats = split( ',', $category);
+$cat_sub_arr = array();
+for ($i = 0; $i < count($cats); $i++)
+{
+    $subcats = get_sub_categories($cats[$i]);
+    for ($j = 0; $j < count($subcats); $j++)
+        array_push($cat_sub_arr, $subcats[$j]);
+    array_push($cat_sub_arr, $cats[$i]);
+}
  • Create URL link for comment posters
scripts/sb_comments.php:160
 $entry_array[ 'website' ] = blog_to_html( $website, true, false, true );
+$entry_array[ 'comment' ][ 'url' ] = $comment_entry_data[ 'URL' ];
 }
software/sphpblog.txt · Last modified: 2013/09/19 16:40 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki