symfony 中的预渲染钩子?

发布于 2024-10-06 22:25:18 字数 50 浏览 0 评论 0原文

symfony 1.4中有类似预渲染钩子的东西吗?我想在视图渲染开始之前执行一些代码。

There is something like pre-render hook in symfony 1.4? I want to execute some code right before view render starts.

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

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

发布评论

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

评论(3

〆凄凉。 2024-10-13 22:25:18

您还可以在 /config/filters.yml 文件中渲染视图之前设置过滤器。有关更多详细信息,请查看此处

You can also set a filter before the view is rendered in the <app>/config/filters.yml file. For further details, take a look here.

忆伤 2024-10-13 22:25:18

尝试在操作类中使用 preExecute()http:// /www.symfony-blog.co.uk/tag/preexecute/

Try to use preExecute() in action class: http://www.symfony-blog.co.uk/tag/preexecute/.

佼人 2024-10-13 22:25:18

Symfony 允许您配置使用的视图类 在模块级别 (module.yml):

all:                  # For all environments
  view_class:         myPHP

然后您可以创建一个 myPHPView 类并重写 sfPHPView::render 方法。

Symfony allows you to configure the view class used at the module level (module.yml):

all:                  # For all environments
  view_class:         myPHP

You could then create a myPHPView class and override the sfPHPView::render method.

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