Opencart how to add everything from a language file to php-loop

Is there a way to read everything from 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'; ?> 
+8
opencart
source share
2 answers

The easiest way is to use array merging 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'); 
+6
source share

The system /library/language.php is there to get everything called all ().

Here's how to get one item:

 $var = $this->language->get('heading_title'); 

Returns an array with all language entries:

 $var = $this->language->all(); 
0
source share

All Articles