How to Print Route in Opencart 3

In controller php file like header.php

$data['route']="";
		if (!isset($this->request->get['route'])) {
			$data['route']="home";//$this->request->get['route'];
		}else		if (isset($this->request->get['route']) && $this->request->get['route']=="common/home") {
			$data['route']="home";
		}else{
			$data['route']=$this->request->get['route'];
		}
		
		return $this->load->view('common/header', $data);

In view twig file like header.twig

 {{ route }}

Leave a Reply