douzhe9075 2015-08-21 11:30
浏览 31
已采纳

哪个在Symfony2中更好:渲染控制器或包含模板?

I develop university site with Symfony2. Besides I'm almost newbie in Symfony.

Index page consists of several blocks: news, events, photos, etc. All objects are fetched from webservices, so no DB is used directly.

I wonder which is better:

  1. Fetch all news,photos,.. objects in DefaultController:indexAction and pass them to index.html.twig as arguments
  2. Call render(controller(News:block)) in index.html.twig. And NewsController in turn fetches objects and renders news_block.html.twig.
  3. Some other way?.. I actually use the second way but I think it is not good.

Please give me advice.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 使用深度学习对于楼梯尺寸进行检测
      • ¥15 特别是3和4 帮帮忙
      • ¥15 C++完成两个子类的构建,基类已给出
      • ¥66 求拉格朗日插值某点的值
      • ¥15 简易的机票预定信息系统
      • ¥15 C++实现对称图形小程序
      • ¥15 大学生考试,各位大哥帮帮忙啊啊。有奖励
      • ¥15 运行和h2o时出现运行错误(无法分析 URI 查询,赋值后找不到象'train_h2o'
      • ¥15 机器学习算法做应用程序
      • ¥40 密码学大作业求大佬帮做