0
我如何重定向到使用重定向或转发功能的不同动作?我的解决方案似乎不工作TYPO3 extbase转发,重定向动作
public function listAction() {
$products = $this->productRepository->findAll();
$this->view->assign('products', $products);
}
public function showAction() {
$var = $this->request->getArgument('searchProduct');
$foundProd = new \MyVendor\Inventory\Domain\Model\Product($var);
$prod = $this->productRepository->getProduct($foundProd);
\TYPO3\CMS\Core\Utility\DebugUtility::debug($prod);
$this->view->assign('test',$prod);
$this->redirect('list',NULL,NULL,array(''));
// $this->forward('list',NULL, NULL, $this->request->getArguments());
}
在视图中,我试图展现foundProduct在同一个页面(而不是建立一个新文件show.html)
<f:widget.paginate objects="{products}" as="paginatedProducts"
configuration="{itemsPerPage: 10, insertAbove: 0, insertBelow: 1, maximumNumberOfLinks: 10}">
<f:for each="{paginatedProducts}" as="productx">
<tr>
<td align="top">{productx.uid}</td>
<td align="top">{productx.name}</td>
<td align="top"><f:format.crop maxCharacters="100">{productx.description}</f:format.crop></td>
<td align="top">{productx.quantity}</td>
</tr>
</f:for>
</f:widget.paginate>
</table>
</div>
<div class="col-sm-5">
<f:form method="post" controller="Inventory" action="show" name="searchProduct" object="{searchProduct}">
<label> Product Name <span class="required"></span><br />
<f:form.textfield property="name" /></label><br />
<f:form.submit class="submit" value="Submit"/>
<div>
<f:for each ="{test}" as ="p">
<P>Numele produsului : {p.name}</P>
<p>Descriere : {p.description}</p>
<p>Cantitate : {p.quantity} </p>
</f:for>
</div>
</div>
提到的模板。那是你想要做的吗? –
我希望这两个动作都在同一页面(.html文件)上执行。 Typo3有点迫使我为每个动作创建一个不同的.html文件,在我的例子中是list.html和show.html。我不希望创建show.html,而是希望showAction在list.html中执行。 –
我无法理解它背后的想法。 'showAction'应该显示一些内容,主要是新闻扩展中的细节视图等记录的细节。我使用重定向的唯一时间是当我例如更新记录并在保存更改后返回列表。你应该过度考虑你的行为以及在那里做些什么。 –