Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

in volt,how to get $_GET etc data value?

url: http://host/controller/test/88

in volt template,how can i get 88?

must in controller use setVar()?

i seen the twig office document, catn't get the value direct

edited Oct '14

You can get it from the dispatcher:

{{ dispatcher.getParam(0) }}

Or from the view component:

{% set params = view.getParams() %}
{{ params[0] }}

Or add a function to the Volt compiler that uses a fancy syntax:

$volt->getCompiler()->addFunction('get_param', function($arguments) {
    return '$this->dispatcher->getParam(' . $arguments . ')';

Then in your view:

{{ get_param(0) }}



but i don't like all of method above

i also use setVar in controller :)