Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opencart how to add everything from the language file in php loop

Tags:

opencart

It there a way to read everything from within a language with Opencart?

At the moment I have to:

Controller
$this->load->language('help');          
$this->data['heading_title'] = $this->language->get('heading_title');    
$this->data['tab1'] = $this->language->get('tab1');

Language File

<?php
// Heading
$_['heading_title']      = 'Help';
$_['tab1'] = 'Account';    
?>
like image 722
John Magnolia Avatar asked Dec 20 '11 12:12

John Magnolia


1 Answers

The easiest thing to do is to use array merge at the top of your controller

$this->data = array_merge($this->data, $this->language->load('language/file'));

or simply

$this->data += $this->language->load('language/file');

Edit

For 2.x, use

$data = array_merge($this->data, $this->language->load('language/file'));

3.x does this automatically

like image 177
Jay Gilford Avatar answered Sep 28 '22 08:09

Jay Gilford