当前位置: 首页 > 工具软件 > Flarum > 使用案例 >

flarum_首先看一下Flarum-下一代论坛变得简单

居英资
2023-12-01

flarum

Flarum is a forums solution that is currently in public beta and is under active development. Today we’re going to take a look at it, get it set up in a Homestead Improved Vagrant virtual machine, and look at the configuration and the features that Flarum offers. Then, we’ll compare it to some other forums platforms to see how it stacks up at a glance.

Flarum是一个论坛解决方案,目前处于公开测试阶段,并且正在积极开发中。 今天,我们将对其进行研究,并在Homestead Improvement Vagrant虚拟机中进行设置,并研究Flarum提供的配置和功能。 然后,我们将其与其他论坛平台进行比较,以一目了然地了解其堆叠方式。

环境设定 (Environment Setup)

For our environment, we’ll be using a Homestead Improved Vagrant VM. More details about the setup can be found in this quick tip on getting Homestead Improved up and running. If another type of development environment is to be used, we can skip this step, otherwise, please follow the above HI setup guide before continuing.

对于我们的环境,我们将使用Homestead改进的Vagrant VM。 有关此设置的更多详细信息,请参见启动和运行Homestead Improvement的快速提示 。 如果要使用其他类型的开发环境,我们可以跳过此步骤,否则, 请按照上述HI设置指南进行操作

For the purposes of this article, the folder used is flarum and the application name (and host set up in /etc/hosts) is flarum.app. In our Homestead.yaml, we should have our flarum.app entry pointing to the home/vagrant/Code directory.

就本文而言,使用的文件夹为flarum ,应用程序名称(和在/etc/hosts设置的/etc/hosts )为flarum.app 。 在我们的Homestead.yaml ,我们的flarum.app条目应指向home/vagrant/Code目录。

Now, after vagrant up we should be able to access our app in our browser via http://flarum.app.

现在, vagrant up我们应该能够通过http://flarum.app在浏览器中访问我们的应用程序。

设置Flarum (Setting up Flarum)

We will be loosely following the Flarum installation guide.

我们将大致遵循Flarum安装指南

First, on our host machine, we download the latest release of Flarum (this article was written using the 0.1.0-beta.2 release). Then, we unzip the contents to our flarum directory.

首先,在我们的主机上,我们下载最新版本的Flarum (本文使用0.1.0-beta.2版本编写)。 然后,将内容解压缩到flarum目录。

Web服务器配置 (Webserver Configuration)

Next, we vagrant ssh into our Homestead VM, and edit our nginx configuration file.

接下来,我们将vagrant ssh到Homestead VM中,然后编辑nginx配置文件。

sudo nano /etc/nginx/sites-available/flarum.app

We’ll need to add the following lines (they can be added just above the location ~ \.php${} block):

我们需要添加以下几行(可以将其添加到location ~ \.php${}块的上方):

location /api { try_files $uri $uri/ /api.php?$query_string; }
    location /admin { try_files $uri $uri/ /admin.php?$query_string; }

    location /flarum {
        deny all;
        return 404;
    }

Then, we’ll restart nginx to make sure that our changes are saved before we begin:

然后,我们将重新启动nginx以确保在开始之前保存我们的更改:

sudo service nginx restart

数据库配置 (Database Configuration)

While still logged into our Vagrant machine, let’s go ahead and set up the Flarum database. When creating the new user, we will choose and set a password for the Flarum application to use to access MySQL.

在仍然登录我们的Vagrant机器的同时,让我们继续设置Flarum数据库。 创建新用户时,我们将为Flarum应用程序选择并设置一个密码,以用于访问MySQL。

mysql -u homestead -psecret
CREATE DATABASE flarum;
  CREATE USER 'flarum'@'localhost' IDENTIFIED BY 'password'; 
  GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost';
  FLUSH PRIVILEGES;

We may then exit the MySQL prompt (CTRL+C). Now, on the host computer, we open our browser and enter flarum.app/. We should see the Flarum installation screen.

然后,我们可以退出MySQL提示符( CTRL+C )。 现在,在主机上,我们打开浏览器并输入flarum.app/ 。 我们应该看到Flarum安装屏幕。

Flarum安装 (Flarum Installation)

We’ll call our test forum “Flarum”. Enter the MySQL connection information. Our user was flarum and our password was password.

我们将测试论坛称为“ Flarum”。 输入MySQL连接信息。 我们的用户是flarum ,我们的密码是password

For administrator credentials, we will use forumsadmin, an email, and a password. For the purposes of this demo, we will just use password.

对于管理员凭据,我们将使用forumsadmin ,电子邮件和密码。 就本演示而言,我们将仅使用password

Note: There is a known bug in this process at the time of this writing. If Flarum does not accept the administrator name (if it is invalid), it will fail silently. Usernames must only contain letters, numbers, dashes, and underscores.

注意 :在撰写本文时,此过程中存在一个已知的错误。 如果Flarum不接受管理员名称(如果该名称无效),它将以静默方式失败。 用户名只能包含字母,数字,破折号和下划线。

If all went well, we will be on the main forum screen. Congratulations – our forum is now functional!

如果一切顺利,我们将在论坛主屏幕上。 恭喜,我们的论坛现已开始运作!

初始调整 (Initial Adjustments)

Let’s page through the Flarum administration menu first. We can access the administration menu from the user menu in the top right.

让我们首先浏览Flarum管理菜单。 我们可以从右上角的用户菜单访问管理菜单。

基本 (Basics)

Under Basics, we can change the banner that currently advises us that Flarum is a beta product, and of course the standard Title, Description, etc.

在“基本知识”下,我们可以更改当前告知我们Flarum是beta产品的标语,当然还有标准的标题,说明等。

权限 (Permissions)

Under Permissions, we have a few basic moderation tools, such as:

在权限下,我们有一些基本的审核工具,例如:

  • Viewing Discussions

    查看讨论
  • Signups

    签约
  • Replying

    回覆
  • Post Editing

    后期编辑
  • Liking

    喜欢
  • Moderation Actions

    审核动作

These can all be applied to user groups, and new groups can be created, allowing us to have multiple levels of trust among our users.

这些都可以应用于用户组,并且可以创建新的组,从而使我们在用户之间具有多个信任级别。

出现 (Appearance)

Under Appearance, we can select the hexadecimal colors we’d like for highlighting and for background elements. We can also toggle on a dark mode or colored header. This is also the place where custom CSS rules can be deployed on top of Flarum’s standard CSS.

在外观下,我们可以选择要突出显示和用于背景元素的十六进制颜色。 我们还可以打开深色模式或彩色标题。 这也是可以在Flarum的标准CSS之上部署自定义CSS规则的地方。

扩展名 (Extensions)

The Extensions tab shows us all of the currently installed extensions. We can click the dotted menu icon next to each (when hovering over it) to disable, enable, or uninstall. In the future, we will be able to use the “add extension” button, but for now, we’ll have to manually install extensions by dropping them into our extensions folder, if we find (or create) any third party ones.

扩展选项卡向我们显示了所有当前安装的扩展。 我们可以单击每个图标旁边的虚线菜单图标(将鼠标悬停在其上)以禁用,启用或卸载。 将来,我们将能够使用“添加扩展名”按钮,但是目前,如果我们找到(或创建)任何第三方extensions ,则必须通过将extensions放到extensions文件夹中来手动安装扩展名。

标签 (Tags)

The last menu, Tags, allows us to create tags that can be used on discussions. Flarum employs a two level tag hierarchy – primary and secondary tags. At the moment, it seems as though the creation dialogue only allows the creation of secondary tags. We can drag these up and deposit them as children of a primary tag, or leave them on the secondary tags list to be displayed alongside the primary tag(s) in the Tag list. This is a bit confusing, hopefully to be cleared up later in development.

最后一个菜单,标签,使我们能够创建可用于讨论的标签。 Flarum采用了两个级别的标签层次结构-主标签和辅助标签。 目前,创建对话似乎只允许创建辅助标签。 我们可以将它们向上拖动并将其作为主要标签的子项存放,或者将它们保留在次要标签列表中,并与“主要”标签中的主要标签一起显示。 这有点令人困惑,希望在以后的开发中予以解决。

主题和扩展 (Themes and Extensions)

Theming is a mixed bag with Flarum. There is an easy way to add one-off styles modifications, in the Appearance section of the admin panel. Flarum uses the CSS preprocessor LESS, which was chosen for a variety of reasons by the developers over Sass and other options.

主题与Flarum混在一起。 在管理面板的外观部分,有一种简单的方法可以添加一次性样式修改。 Flarum使用CSS预处理器LESS ,开发人员出于各种原因选择了CSS预处理器LESS来选择Sass和其他选项。

定制示例 (Example Customizations)

Here is our flarum.app, with Dark Mode turned on via the Appearance administration tab.

这是我们的flarum.app ,通过外观管理选项卡flarum.app了暗模式。

We will do a quick customization to demonstrate how simple it is to make small stylistic changes to the theme.

我们将进行快速自定义,以演示对主题进行小的样式更改是多么简单。

If we go to the Appearance tab in the administration menu, and click ‘Edit Custom CSS’, we can then enter our own custom CSS or LESS.

如果转到管理菜单中的外观标签,然后单击“编辑自定义CSS”,则可以输入我们自己的自定义CSS或LESS。

Our goal for this simple customization will be to alter the color of the ‘Start a Discussion’ button. We would like to make it red, to make it more eye-catching to the new visitor. So, after we identify the class we want to target as IndexPage-newDiscussion, we can go ahead and just write out a single line of CSS:

我们进行此简单自定义的目标是更改“开始讨论”按钮的颜色。 我们希望将其设为红色,以使其对新访客更具吸引力。 因此,在我们确定要定位为IndexPage-newDiscussion的类之后,我们可以继续进行操作,只写一行CSS:

.IndexPage-newDiscussion {background:#ff0000;}

And that’s all there is to it. If we take a look at our home page again, we will see our change in place:

这就是全部。 如果再次查看我们的主页,我们将看到适当的更改:

Changes can, in theory, be made to any of the styles in the app. Now, of course, we will want to alter more than a few small styles when we are using Flarum in production. One way to do that will be to build our own theme files, within the extensions system.

从理论上讲,可以对应用程序中的任何样式进行更改。 当然,现在,当我们在生产中使用Flarum时,我们将希望更改多个小样式。 一种方法是在扩展程序系统中构建我们自己的主题文件。

扩展名 (Extensions)

If we have alterations to the structure, functionality, or appearance of the instance to perform beyond what the administration menu or default extensions offer, we can create our own extension. Extensions will be an integral part of Flarum as the community grows, especially given the ease with which they can be created. A skeleton extension can be generated as the first step to create an extension. The theming portion of extensions is explained more fully on the themes documentation page. With regards to themes, Flarum also helpfully provides a list of the LESS variables used in the site in the variables.less file, and they use a BEM naming convention for CSS classes.

如果我们要更改实例的结构,功能或外观以执行超出管理菜单或默认扩展名所能提供的功能,则可以创建自己的扩展名。 随着社区的发展,扩展将成为Flarum不可或缺的一部分,尤其是考虑到可以轻松创建扩展的情况。 可以将骨架扩展生成为创建扩展的第一步。 扩展的主题部分在主题文档页面上有更详细的说明 。 关于主题,Flarum还帮助在variables.less文件中提供了站点中使用的LESS变量的列表,并且它们对CSS类使用BEM命名约定

一般特征 (General Features)

  • Infinite Scrolling – this is similar to Discourse, another modern forums platform. Users seem to have a very polar response to this – we love it, or we hate it. Historically, forums software limits the amount of topics or replies within a topic to a certain amount per “page”, requiring us to load a new page to view more. In Flarum, a viewer of a conversation can just scroll through a conversation, loading more responses as they go, until the end – however long it is.

    无限滚动 –类似于另一个现代论坛平台Discourse。 用户对此似乎有非常反感–我们喜欢它,或者我们讨厌它。 从历史上看,论坛软件将主题或主题中的回复的数量限制为每个“页面”一定数量,这要求我们加载新页面才能查看更多内容。 在Flarum中,对话的查看者可以滚动浏览整个对话,并随即加载更多响应,直到结束(无论时间长短)。

  • Touch Friendly – this is a feature that makes Flarum really stand out. It’s been touch optimized from the start, with gesture support (swipe right to mark a discussion “read” or left to get more options). The animations aren’t overly bulky and the pages are not noticeably slower to load on mobile, either.

    触摸友好 -这是使Flarum真正脱颖而出的功能。 从一开始就对触摸进行了优化,并提供了手势支持(向右滑动以将讨论标记为“已读”,向左滑动以获取更多选项)。 动画也不会过于庞大,并且页面在移动设备上的加载也不会明显变慢。

  • URLs – Flarum URL formats are intuitive. The url of the tag ‘General’ will be <app base url>/t/general. The URL of our first discussion called ‘test’ which is tagged as ‘general’ will be <app base url>/d/1-test. Also, a post number is appended to the URL to indicate which post within a discussion is being read.

    URL – Flarum URL格式直观。 标签“常规”的url为<app base url>/t/general 。 我们第一次讨论的名为“ test”的URL被标记为“ general”,将为<app base url>/d/1-test 。 另外,URL后面会附加一个帖子编号,以指示正在阅读讨论中的哪个帖子。

  • Editor – Flarum employs a “floating editor” which appears as a sort of pop up attached at the bottom of the page. We can navigate freely around Flarum while composing our reply to a discussion, allowing us to look at other discussions as needed to compose our response. This is a feature also found in Discourse, and it’s quite handy. The Flarum editor supports MarkDown, BBCode, and Emoji, and will be extensible to support more.

    编辑器 – Flarum使用了一个“浮动编辑器”,它以一种弹出式形式出现在页面底部。 在撰写对某个讨论的答复时,我们可以在Flarum上自由浏览,从而使我们能够根据需要查看其他讨论以构成我们的回应。 这也是“话语”中的一项功能,非常方便。 Flarum编辑器支持MarkDown,BBCode和Emoji,并且可以扩展以支持更多内容。

  • Moderation – The customizable moderation groups and permissions are a definite boon for the platform. Even in beta stages, there is already attention being given to moderation, which any community administrator knows is a critical part of running forums.

    审核 –可自定义的审核组和权限对于平台来说无疑是福音。 即使在测试阶段,也已经开始关注主持人,任何社区管理员都知道主持人是运行论坛的关键部分。

与其他平台的比较 (Comparison to Other Platforms)

Overall, Flarum seems as if at release, it may compare well to modern forums platforms like Discourse. Discourse or NodeBB may well be the only real competitors in the same arena. While other modern forums platforms exist, such as vBulletin 5 or Vanilla, Flarum feels like it stands out in a way countered by few. In some cases, it may boil down to a language preference: Discourse is a Ruby on Rails platform, while NodeBB is a Node.js platform.

总体而言,Flarum似乎在发布时,可以与Discourse之类的现代论坛平台相提并论。 话语NodeBB很可能是同一领域中唯一真正的竞争对手。 尽管存在其他现代论坛平台,例如vBulletin 5或Vanilla,但Flarum觉得它以很少有人反对的方式脱颖而出。 在某些情况下,它可能归结为语言偏好:Discourse是Ruby on Rails平台,而NodeBB是Node.js平台。

Flarum is very mobile friendly, which is a struggle for forums in general, but a critical future-proofing feature. Discourse is getting there, but is still a little clunky on mobile, and NodeBB is also mobile friendly – in fact, it claims to be developed mobile first.

Flarum对移动设备非常友好,这对于论坛来说是一个艰巨的挑战,但它是面向未来的关键功能。 话语已经到了,但在移动设备上仍然有些笨拙,NodeBB也是移动设备友好的–实际上,它声称首先开发移动设备。

The tag based navigation of Flarum may alienate fans of static categories, but we see this more and more in web applications, and tag based sorting definitely has its advantages. Discourse, conversely, uses both categories and tags, and how the combination works out can depend wildly on the implementation, sometimes very useful, other times just a mess. It may depend on the user base’s preferences whether tag-based sorting is a pro or a con of Flarum.

Flarum的基于标签的导航可能会疏远静态类别的支持者,但是我们在Web应用程序中越来越多地看到这种情况,并且基于标签的排序无疑具有其优势。 相反,话语同时使用类别和标签,并且组合的工作方式可能完全取决于实现,有时非常有用,有时只是一团糟。 基于标签的排序是Flarum的优点还是缺点,这取决于用户群的偏好。

Resources are another big concern, when comparing platforms, and Flarum wins the contest with most other modern platforms (like Discourse) hands-down. It can run on hosts with lower specifications, and feels snappier. This comes at a cost though, as we are forced to consider that more (relatively) mature platforms such as Discourse may have more stability, and already have large communities to support and extend them. Flarum is not yet even ready for production, so time will tell whether this advantage shrinks or becomes overshadowed.

比较平台时,资源是另一个大问题,而Flarum与其他大多数现代平台(如Discourse)一起赢得了比赛。 它可以在规格较低的主机上运行,​​并且感觉更加敏捷。 不过,这是有代价的,因为我们被迫考虑像Discourse这样的更多(相对)成熟的平台可能具有更高的稳定性,并且已经有大型社区来支持和扩展它们。 Flarum尚未准备好进行生产,因此时间将证明这种优势是缩小还是被掩盖了。

结论 (Conclusions)

Whether one chooses Flarum as their forums platform of choice may depend on a variety of things. What language do we prefer? A PHP core makes Flarum an excellent choice for PHP developers and for those working with pre-existing PHP applications. The release roadmap and progress of Flarum may tell us much, as well. We can watch to see the development progress, feedback from users, and features that are added into Flarum. As the extensions system matures, and the theming options, we will be able to gauge how customizable this platform will actually be – and whether or not a strong user base grows behind it, or whether it falters. Either way, it should definitely remain on our radar for future projects!

是否选择Flarum作为他们选择的论坛平台可能取决于多种因素。 我们喜欢哪种语言? 对于PHP开发人员以及使用预先存在PHP应用程序的开发人员来说,Flarum是PHP的绝佳选择。 Flarum的发布路线图和进度可能也会告诉我们很多信息。 我们可以观察到开发进度,用户反馈以及Flarum中添加的功能。 随着扩展系统的成熟以及主题选项的发展,我们将能够评估该平台的实际可定制性-以及强大的用户群是否在其后面发展,或者它是否步履蹒跚。 无论哪种方式,对于将来的项目,它绝对应该留在我们的雷达上!

翻译自: https://www.sitepoint.com/first-look-at-flarum-next-generation-forums-made-simple/

flarum

 类似资料: