petegore / blog-bundle
Symfony GoreBlogBundle
dev-master
2014-09-19 16:03 UTC
Requires
- php: >=5.3.3
- friendsofsymfony/user-bundle: 2.0.*@dev
- hwi/oauth-bundle: 0.4.*@dev
- stfalcon/tinymce-bundle: dev-master
- stof/doctrine-extensions-bundle: 1.1.*@dev
- symfony/symfony: 2.5.*
This package is not auto-updated.
Last update: 2024-09-24 03:29:57 UTC
README
Symfony2博客组件(开发中)
该组件尚未完善:博客缺少很多功能,并且存在许多bug。
我将它放在GitHub / Packagist上,以便在开发的同时使用和测试。您可以在我的开发者博客上查看进度,该博客与组件同时启动: http://www.petegore.fr
感谢您的理解:)
使用
GoreBlodBundle使用了不同的现有组件,如
- FOSUserBundle:用户管理
- HWIOAuthBundle:与Twitter、Fb等连接...
- StofDoctrineExtensionsBundle:使用Doctrine扩展,如Sluggable
- StfalconTinymceBundle:将TinyMCE作为文章的文本编辑器加载
所有这些组件将同时与BlogBundle安装。
安装
需要主组件
将以下需求添加到您的composer.json文件中
# composer.json
"require": {
...
"petegore/blog-bundle": "dev-master"
},
然后运行更新composer命令
$ php composer.phar update
启用组件
# app/AppKernel.php $bundles = array( ... /** Blog and associated bundles **/ new Gore\BlogBundle\GoreBlogBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new FOS\UserBundle\FOSUserBundle(), new Stfalcon\Bundle\TinymceBundle\StfalconTinymceBundle(), new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), );
创建主路由
添加主博客路由和FOSUserBundle路由
# app/config/routing.yml # ROUTING FOR HWIOAUTHBUNDLE : LET BEFORE THE OTHER ROUTES hwi_oauth_redirect: resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" prefix: /connect hwi_oauth_login: resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" prefix: /login # ROUTING FOR BLOGBUNDLE blog: resource: "@GoreBlogBundle/Resources/config/routing/routing.yml" prefix: / # ROUTING FOR FOSUSERBUNDLE fos_user_security: resource: "@FOSUserBundle/Resources/config/routing/security.xml" fos_user_profile: resource: "@FOSUserBundle/Resources/config/routing/profile.xml" prefix: /profile fos_user_register: resource: "@FOSUserBundle/Resources/config/routing/registration.xml" prefix: /register fos_user_resetting: resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" prefix: /resetting fos_user_change_password: resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" prefix: /profile logout: pattern: /logout
创建security.yml文件
# app/config/security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_ADMIN]
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
更新数据库模式
通过运行update更新您的数据库模式
$ php app/console doctrine:schema:update --force
创建您的管理员用户
通过运行以下命令(例如)
$ php app/console fos:user:create admin admin@mywebsite.com admin $ php app/console fos:user:promote admin ROLE_ADMIN
更新资源
运行assets:install以安装公共资源
$ php app/console assets:install web/
创建图片文件夹
在您的web/文件夹中创建一个文件夹来存储文章图片。例如:"web/pictures"。注意:文章创建过程将根据年份和月份创建子文件夹。
设置最小配置
您只需要在YAML配置文件中定义图片文件夹
# app/config/config.yml # Blog configuration gore_blog: pictures_folder: pictures/ # will be completer later # FOSUserBundle fos_user: db_driver: orm firewall_name: main user_class: Gore\BlogBundle\Entity\User # Doctrine extensions bundle stof_doctrine_extensions: default_locale: %locale% orm: default: sluggable: true # Text editor and syntax highlighter stfalcon_tinymce: tinymce_jquery: true selector: ".tinymce" language: %locale% external_plugins: sh4tinymce: url: "asset[bundles/goreblog/lib/tinymce-plugin/sh4tinymce/plugin.js]" theme: simple: ~ advanced: plugins: - "advlist autolink lists link image charmap print preview hr anchor pagebreak" - "searchreplace wordcount visualblocks visualchars code fullscreen" - "insertdatetime media nonbreaking save table contextmenu directionality" - "emoticons template paste textcolor" toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" toolbar2: "print preview media | forecolor backcolor emoticons | stfalcon | example"
自定义博客
以下是将博客上可以设置的完整配置示例
gore_blog: pictures_folder: pictures/ blog_title: Chroniques d'un devweb main_articles_to_show: 2 small_articles_to_show: 3 social_networks_urls: email: test@myblog.com twitter : http://twitter.com/mypseudoontwitter ### etc... many social networks are availables
@待完成