Render
The render function takes a mandatory argument action
, that is the method of the action. It supports a:b:c
notation.
Example:
{render action="Module:Foo:bar"}
Will executes Module\Controller\FooController::barAction
and print the result.
You can specify the request method:
{render action="Module:Foo:bar" method="PUT"}
You can specify the query parameters:
{render action="Module:Foo:bar" query="foo=bar&baz=thelia"}
{render action="Module:Foo:bar" query=$anArray}
Same for request (if the method isn’t specified, it will automaticly set it to POST):
{render action="Module:Foo:bar" request="foo=bar&baz=thelia"}
{render action="Module:Foo:bar" request=$anArray}
All the other parameters will be used as the method parameters. You can execute the following controller:
<?php
namespace Module\Controller\FooController;
use Thelia\Controller\Front\BaseFrontController;
use Thelia\Core\HttpFoundation\Response;
class TestController extends BaseFrontController
{
public function barAction($paramA, $paramB)
{
return new Response($paramA . $paramB);
}
}
with the method:
{render action="Module:Foo:bar" paramA="foo" paramB="bar"}