Something like base_url from codeigniter for opencart?

Toni Michel Caubet picture Toni Michel Caubet · Oct 15, 2013 · Viewed 12.4k times · Source

Codeigniter has a function, base_url()

<?php echo base_url('/file')?>

that prints the absolute URL,

Is there any equivalent for Opencart?

Answer

Jenson M John picture Jenson M John · Oct 15, 2013

Look in the header.php controller file

 if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
     $this->data['base'] = $this->config->get('config_ssl');
  } else {
     $this->data['base'] = $this->config->get('config_url');
  }

Just call below from your template file.

<?php echo $base; ?>