opencartopencart-3opencart-module

How do i get site url dynamically in admin twig file in opencart?


I am trying to get my site url like; https://www.example.com/ in admin twig file for my custom module. Can anyone help me please?

I tried this, but no result;

{{ HTTPS_CATALOG }}


Solution

  • In your corresponding controller file define:

    $data['site_url'] = $_SERVER['HTTP_HOST'];
    

    in corresponding twig file you can call this data:

    {{ site_url }}
    

    If the answer are useful for you, can you mark it "This answer is useful"