为什么TYPO3在Core中没有页面模型? [英] Why doesn't TYPO3 have a Page Model in Core?

查看:42
本文介绍了为什么TYPO3在Core中没有页面模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用核心 PageRepository (TYPO3 \ CMS \ Frontend \ Page \ PageRepository)时,使用功能 getPage (),我得到一个数组返回的,而不是对象,就像其他许多核心存储库一样.然后,我必须为自己构建一些魔术",以注入 类别页面作者作为对象 用于流体模板.问题是根本不提供页面模型是一种设计决定"吗?

When I use the core PageRepository (TYPO3\CMS\Frontend\Page\PageRepository), function getPage(), I get an array returned and not an object, as in many other core repositories. Then I have to build some "magic" for myself in order to inject the Categories or the Page Author as Objects to be used in the Fluid Templates. Question is if it is a kind of "design decision" not to provide a Page Model at all?

推荐答案

您无需在数组外构建对象即可在Fluid中使用.

You would not have to build an object out of the array for usage in Fluid.

您也可以将数组传递给视图.您将像使用对象一样使用.-符号.

You can also just pass the array to the view. You would use the .-notation just like with an object.

例如在控制器中:

$this->view->assign('page', $page);

流体:

{page.title}

这篇关于为什么TYPO3在Core中没有页面模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆