The sfSimpleBlog15Plugin
is a symfony plugin to create a simple blog. This plugin use sfPropelORMPlugin, and it is based on sfSimpleBlogPlugin.
The sfSimpleBlog15Plugin
adds standard weblog features to an existing website:
- List of posts
- Details of a post
- Ability to add a page (for example: about page)
- Email alert on comments and ability to add a comment (using sfNestedCommentPlugin)
- Tagsonomy (using sfPropelActAsTaggableBehaviorPlugin)
- RSS feeds (if sfFeed2Plugin is installed)
- Administration for posts, comments, pages, links and tags
It is not aimed at replacing full-featured blog packages, but offers a lightweight alternative for when you build a website that has to contain a blog section.
This plugin contains nine modules that you can activate in whatever application you need them:
sfSimpleBlog
: Blog front-endsfSimpleBlogFeed
: Blog feeds (automatically enabled ifuse_feeds
setting is true)sfSimpleBlogAdmin
: Backend dashboardsfSimpleBlogPostAdmin
: Backend for managing postssfSimpleBlogCategoryAdmin
: Backend for managing categoriessfSimpleBlogLinkAdmin
: Backend for managing linkssfSimpleBlogLinkCategoryAdmin
: Backend for managing link categoriessfSimpleBlogPageAdmin
: Backend for managing pagessfSimpleBlogTagAdmin
: Backend for managing tags
-
Install the plugin
git clone git://github.com/nibsirahsieu/sfSimpleBlog15Plugin.git
-
Activate the plugin in the
config/ProjectConfiguration.class.php
[php] class ProjectConfiguration extends sfProjectConfiguration { public function setup() { ... $this->enablePlugins('sfSimpleBlog15Plugin'); ... } }
-
Symfony Plugins :
- sfGuardPlugin
- sfPropelORMPlugin
- sfNestedCommentPlugin
- sfPropelActAsTaggableBehaviorPlugin
- sfPropelTaggableWidgetPlugin (trunk version)
- sfSyntaxHighlighterPlugin
- sfThemePlugin
- themeVeryplaintxtPlugin
- sfFeed2Plugin
- sfAssetLibraryPlugin
- sfThumbnailPlugin
- sfFormExtraPlugin
- omCrossAppUrlPlugin
- sfJqueryReloadedPlugin
- sfPropelLuceneableBehaviorPlugin
-
tinymce plugins:
-
First, activate
User Dependent Forms
, see this article for detail. -
Enable one or more modules in your
settings.yml
(optional)[yml] all: .settings: enabled_modules: - default - sfSimpleBlogAdmin - sfSimpleBlogCategoryAdmin - sfSimpleBlogLinkAdmin - sfSimpleBlogLinkCategoryAdmin - sfSimpleBlogPageAdmin - sfSimpleBlogPostAdmin - sfSimpleBlogTagAdmin ....
-
setup the dashboard
Set your application's
homepage
in your application'srouting.yml
to:[yml] homepage: url: / param: { module: sfSimpleBlogAdmin, action: dashboard }
-
change the name of the user profile class and the foreign key name in
app.yml
:[yml] sf_guard_plugin: profile_class: sfSimpleBlogAuthor profile_field_name: user_id
-
Change the parent class in
myUser.class.php
[php] class myUser extends sfSimpleBlogSecurityUser { }
-
Enable sfSimpleBlog module in your
settings.yml
;[yml] all: .settings: enabled_modules: [default, sfSimpleBlog]
-
Set your application's
homepage
in your application'srouting.yml
to:[yml] homepage: url: / param: { module: sfSimpleBlog, action: index }
-
change the name of the user profile class and the foreign key name in
app.yml
:[yml] sf_guard_plugin: profile_class: sfSimpleBlogAuthor profile_field_name: user_id
-
Change the parent class in
myUser.class.php
[php] class myUser extends sfSimpleBlogSecurityUser { }
The plugin is highly configurable and should be easy to integrate to an existing project. Here is the default plugin configuration, taken from myproject/plugins/sfSimpleBlog15Plugin/config/app.yml
:
all:
sfSimpleBlog:
default_theme: veryplaintxt #refer to themeVeryPlaintxtPlugin
admin_theme: backend_theme
title: sfSimpleBlog
use_feeds: true # enable feeds (require sfFeed2Plugin)
use_post_extract: true # display extract in post list instead of full post body
post_max_per_page: 5 # number of posts displayed in a list of posts
post_recent: 5 # number of posts to display in the recent sidebar widget
feed_count: 5 # number of posts appearing in the RSS feed
sidebar: [tags, recent_posts, recent_comments, feeds, links, month_archives]
comment_disable_after: 0 # number of days after which comments on a post are not possible anymore
share_on: # social bookmarks (see SocialBookmarkingHelper.php)
- twitter
- facebook
- delicious
- stumbleupon
- digg
- reddit
month_archives: 12
theme:
themes:
backend_theme:
description: Backend Theme
layout: backend_layout
templates_dir: sfSimpleBlog15Plugin/templates/
stylesheets:
- ../sfSimpleBlog15Plugin/css/main.css
- ../sfSimpleBlog15Plugin/css/style.css
- ../sfSimpleBlog15Plugin/css/button.css
javascripts: []
You can customize these settings in myproject/apps/myapp/config/app.yml
The sidebar
array controls which widgets, and in which order, appear in the sidebar of the blog frontend. The existing widgets are:
recent_posts
: list of recent poststags
: list of popular tagsfeeds
: links to the RSS and Atom feedsrecent_comments
: list of recent commentslinks
: list of linksmonth_archives
: list of archives per month
The routes are automatically registered unless you defined sfSimpleBlog_routes_register
to false in the app.yml
configuration file:
[yml]
all:
sfSimpleBlog:
routes_register: false
As a consequent, you have to define the routes in your routings.yml
. This is useful if you want to handle cross application routing using swCrossLinkApplicationPlugin.
Those routes are (see sfSimpleBlog15Routing.class.php
):
[yml]
sf_simple_blog_show_page:
url: /page/:page_title
param: { module: sfSimpleBlog, action: page }
sf_simple_blog_show:
url: /:year/:month/:day/:stripped_title
param: { module: sfSimpleBlog, action: show }
sf_simple_blog_show_by_tag:
url: /tag/:tag
param: { module: sfSimpleBlog, action: showByTag }
sf_simple_blog_show_by_category:
url: /category/:category
param: { module: sfSimpleBlog, action: showByCategory }
sf_simple_blog_search:
url: /search
param: { module: sfSimpleBlog, action: search }
sf_simple_blog_posts_feed:
url: /posts/:format
param: { module: sfSimpleBlogFeed, action: postsFeed, format: atom1 }
sf_simple_blog_comments_feed:
url: /comments/:format
param: { module: sfSimpleBlogFeed, action: commentsFeed, format: atom1 }
sf_simple_blog_posts_tag_feed:
url: /tags/:tag/:format
param: { module: sfSimpleBlogFeed, action: postsForTagFeed, format: atom1 }
sf_simple_blog_comments_post_feed:
url: /:year/:month/:day/:stripped_title/comments/:format
param: { module: sfSimpleBlogFeed, action: commentsForPostFeed, format: atom1 }
sf_simple_blog_month_archives:
url: /:year/:month/archives
param: { module: sfSimpleBlog, action: monthArchives }
sf_simple_blog_post_view_version:
url: /sf_simple_blog_post/:id/show.:sf_format
param: { module: sfSimpleBlogPostAdmin, action: viewVersion, sf_format: html}
sf_simple_blog_post_restore_version:
url: /sf_simple_blog_post/:id/restore.:sf_format
param: { module: sfSimpleBlogPostAdmin, action: restoreVersion, sf_format: html}
sf_simple_blog_post_delete_version:
url: /sf_simple_blog_post/:id/delete.:sf_format
param: { module: sfSimpleBlogPostAdmin, action: deleteVersion, sf_format: html}
sf_simple_blog_post_delete_versions:
url: /sf_simple_blog_post/deleteVersions.:sf_format
param: { module: sfSimpleBlogPostAdmin, action: deleteVersions, sf_format: html}
sf_simple_blog_post:
class: sfPropelORMRouteCollection
options:
model: sfSimpleBlogPost
module: sfSimpleBlogPostAdmin
prefix_path: /sf_simple_blog_post
column: id
with_wildcard_routes: true
sf_simple_blog_category:
class: sfPropelORMRouteCollection
options:
model: sfSimpleBlogCategory
module: sfSimpleBlogCategoryAdmin
prefix_path: /sf_simple_blog_category
column: id
with_wildcard_routes: true
sf_simple_blog_page:
class: sfPropelORMRouteCollection
options:
model: sfSimpleBlogPage
module: sfSimpleBlogPageAdmin
prefix_path: /sf_simple_blog_page
column: id
with_wildcard_routes: true
sf_simple_blog_tag:
class: sfPropelORMRouteCollection
options:
model: Tag
module: sfSimpleBlogTagAdmin
prefix_path: /sf_simple_blog_tag
column: id
with_wildcard_routes: true
sf_simple_blog_link:
class: sfPropelORMRouteCollection
options:
model: sfSimpleBlogLink
module: sfSimpleBlogLinkAdmin
prefix_path: /sf_simple_blog_link
column: id
with_wildcard_routes: true
sf_simple_blog_link_category:
class: sfPropelORMRouteCollection
options:
model: sfSimpleBlogLinkCategory
module: sfSimpleBlogLinkCategoryAdmin
prefix_path: /sf_simple_blog_link_category
column: id
with_wildcard_routes: true
This plugin use themeVeryplaintxtPlugin as a default theme. You can create your own theme and set it as default. You can find the instruction here themeTwentytenPlugin
all:
sfSimpleBlog:
default_theme: your_theme
This plugin comes with the default backend theme. To activate it, add the code below to your backend configuration (fe: backendConfiguration.class.php)
[php]
public function configure()
{
$this->dispatcher->connect('controller.change_action', array('sfSimpleBlog15PluginConfiguration', 'loadBackendTheme'));
}
This plugin also packaged a login form. Currently, it works with sfGuardPlugin. Include it like this:
// in application/modules/sfGuardAuth/templates/signinSuccess.php
<?php include_partial('sfSimpleBlogAdmin/login', array('form' => $form)); ?>
Then in your myproject/apps/myapp/config/app.yml
, add a configuration below:
all:
sf_guard_plugin:
signin_form: sfSimpleBlogFormSignin
- http://nibsirahsieu.com, this is my own blog and it is built on this plugin