如何从 Twig 调用控制器的函数

How to Call a function of Controller From Twig

这是我的观点:

<div class="CSlider">
<div class="CProducts" >
<table>
<tr>
{% for count in 1..result|length %}
<td>
{% block tile %}
{% include 'tile.twig' %}
{% endblock %}
<h1>
{{ result[ count - 1 ].id }}
</h1>
</td>
{% if count is divisible by (6) %}
</tr>
<tr>
{% endif %}
{% endfor %}
</table>
</div>
</div>

这是我的控制器:

class COlxMyAdsController extends COlxDatabaseHandler {
protected $view;
public function __construct($container){
parent::__construct($container);
$this->view=$container->view;
}
public function fetchMyLiveAdIdsByUserId( Request $request, Response $response ) {
$args=$request->getParams();
$args=$args['id'];
$results = $this->m_objOlxUserDetails->fetchMyLiveAdIdsByUserId($args);
return $this->view->render($response,'profile.twig',['result' => $results]);
}
}

我想从视图中调用控制器的一个函数。我如何使用 Twig 做到这一点?

这里我们可以使用Exit_Tags

通过它我们可以给那个exit_tag分配一个URL来调用这个函数