简体   繁体   中英

Does anyone know how to get parameter from url in .twig formate

Does anyone know how to get parameter from url like this:

mywebsite.com/index.php?route=account/register&a=1&b=2

i want to get param: a , b in .twig files opencart 3.x

Why you need it get in twig? You can get it in corresponding controller file:

if (isset($this->request->get['a'])) {
            $a = $this->request->get['a'];
} else {
$a = '';
}
if (isset($this->request->get['b'])) {
            $b = $this->request->get['b'];
} else {
$b = '';
}

and call in twig...

{{ a }} {{ b }} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM