在 Symfony2 中集成 HerzultForumBundle

发布于 2025-01-02 02:27:34 字数 402 浏览 4 评论 0原文

我已将 HerzultFourmBundle 安装到我的 Symfony2 应用程序中,在应用程序内核中添加了调用并自动加载并扩展了基类。我遇到的问题是我有一个应用于应用程序中每个页面的站点布局,我想在其中呈现论坛。

我对 Symfony 和 PHP 很陌生,但我尝试了几种方法来让它工作。我设置了一个控制器方法,可以正确呈现论坛页面,该页面是通过正常路由配置设置的,我也可以设置它,以便路由到 Herzult 论坛包中论坛控制器中的索引方法。然而,这呈现了论坛索引页面的默认样式,并且不包含在我需要的布局中。

有人可以为我提供一个如何实施论坛并将其集成到网站中的示例吗?一个简单的例子将为我指明正确的方向。

I have installed the HerzultFourmBundle into my Symfony2 application, added the calls in the app kernel and auto load and extended the base classes. The problem i am having is i have a site layout that is applied to every page in the application and i want to render the forum within this.

I am very new to Symfony and PHP, but i have tried a few ways to get this working. I have a controller method set up that will render the forum page correctly which is set through the normal routing configuration, i can also set it up so that is routes to the index method in the Forum controller in the Herzult forum bundle. However this renders the default styles for the forum index page and is not contained by the layout i require.

Can someone provide me with an example of how to implement the forum and integrate it into a site? A simple example would point me in the right direction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Spring初心 2025-01-09 02:27:34

如果您查看捆绑包的主布局文件 你会注意到它扩展了 '::base.html.twig' 模板:

{% extends '::base.html.twig' %}

这是一个应用程序级模板,位于apps/Resources/viewsbase.html.twig 文件。
只要您使用此模板,您就应该能够定义您的自定义内容。

这是一个称为“三级模板继承”的约定。在文档中阅读有关它的更多信息: http://symfony.com /doc/2.0/book/templatating.html#third-level-inheritance

请注意,HerzultForumBundle 目前正在紧张开发中。某些功能可能会丢失。

If you look at bundle's main layout file you'll notice that it extends '::base.html.twig' template:

{% extends '::base.html.twig' %}

This is an application level template located in apps/Resources/viewsbase.html.twig file.
You should be able to define your custom stuff as long as you're using this template.

This is a convention called "Three level template inheritance". Read more about it in the documentation: http://symfony.com/doc/2.0/book/templating.html#three-level-inheritance

Note that HerzultForumBundle is currently under intensive development. Some features might be missing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文