【发布时间】:2016-10-24 06:00:41
【问题描述】:
/**
* New post form
* @param \Vendor\My\Domain\Model\Post|null $newPost New post
* @return void
* @dontvalidate $newPost
*/
public function newAction(\Vendor\My\Domain\Model\Post $newPost = NULL) {
$this->view->assign('test', 'hello');
$this->view->assign('categoryList', $this->categoryRepository->findAllByBlog(0));
$this->view->assign('postObject', $newPost);
}
public function editAction() {
$this->view->assign('categoryList', $this->categoryRepository->findAllByBlog(0));
$postObject = $this->postRepository->findOneByUid($this->request->getArgument('id'));
$this->view->assign('postObject', $postObject);
}
这是我的脚本,我的问题是我有一个 categoryList 数组,它只进入编辑视图。我想在 newaction 上使用该类别列表。当我尝试在新的操作视图文件中搜索该数组时,它变得空了。我可以在保存 postObject 后得到它。关于这个特殊问题的任何想法?来自 newaction 的变量测试在 newAction 模板文件中也不可见。
我正在使用 Typo3 7.6.11
【问题讨论】:
-
愚蠢的问题:更改后是否清除 T3 缓存?
<f:debug>{_all}</f:debug>看到了什么? -
是的,什么都试过了。我只能在控制器操作中看到这些变量,它在视图和操作之间未设置。
-
您是在模板中还是部分地访问这些变量?在第二种情况下,您可能不会通过
arguments将所有变量传递给部分变量。 -
伙计,在我的问题中,您可以看到 new 和 editAction,两者都使用相同的模板,只是编辑、添加标签正在更改,而我使用的是部分,并传递了所有参数,这些值在编辑视图(模板和部分)上正确获取,但是从 newAction 呈现该视图时它不起作用。
标签: typo3 typoscript fluid extbase typo3-7.6.x