codingfarm / the-forum-bundle
该软件包最新版本(dev-master)没有提供许可证信息。
dev-master
2013-07-29 13:32 UTC
Requires
- knplabs/knp-time-bundle: 1.1.*@dev
- mjohnson/decoda: 4.1.1
- symfony/framework-bundle: 2.*
- white-october/pagerfanta-bundle: *
This package is not auto-updated.
Last update: 2024-09-28 13:04:34 UTC
README
需求
- KnpTimeBundle
- WysiBB分支 https://github.com/jekill/WysiBB
- WhiteOctoberPagerfantaBundle
- KnockoutJS
主要功能和概念
论坛与现有的授权系统没有硬绑定,仅依赖于Symfony\Component\Security\Core\User\UserInterface,因此您可以使用任何实现,例如FOSUserBundle。
论坛有三个主要实体
- 类别
- 主题
- 帖子
安装
步骤 1:使用composer下载CFTheForumBundle
在您的composer.json中添加CFTheBundle
{ "require": { "codingfarm/the-forum-bundle": "dev-master" } }
现在运行以下命令让composer下载该组件
$ php composer.phar update codingfarm/the-forum-bundle
Composer将安装该组件到您的项目目录 vendor/codingfarm/the-forum-bundle/
。
步骤 2:启用组件
在kernel中启用组件
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new CF\TheForumBundle\CFTheForumBundle(), ); }
步骤 3:配置
# app/config/config.yml cf_the_forum: db_driver: orm image: upload_dir: /uploads/forum/ max_height: 400 max_width: 700 video: width: 459 height: 341 video_url_services: - forum.services.video.youtube - forum.services.video.rutube - forum.services.video.smotri - forum.services.video.vimeo - forum.services.video.ttk class: model: post: Application\ForumBundle\Entity\Post topic: Application\ForumBundle\Entity\Topic category: Application\ForumBundle\Entity\Category bridge: user_meta: Application\ForumBundle\Bridge\UserMeta permissions: service_class: Application\ForumBundle\Services\ForumPermissions bbcode_filters: - forum.bbcode_filter.main - forum.bbcode_filter.image - forum.bbcode_filter.video - forum.bbcode_filter.url
步骤 4:实现模型类
桥接
此类需要提供项目特定用户的数据 - 名称、头像、...
use CF\TheForumBundle\Bridge\UserMeta as AbstractUserMeta; class UserMeta extends AbstractUserMeta { /** * Return the name of the user * * @param $user * * @return string */ public function getUsername($user) { return $user->getUsername(); } /** * Return the picture's url of user's avatar * * @param $user * * @return string (/img/avatars/default.gif) */ public function getUserAvatar($user) { // return $user->getAvatarSrc(); return '/img/avatars/default.gif'; } }