It is extremely boring to set all the language variables in the controller .So i am writing a shortcut function to reduce the number of lines of code in opencart..
First go and write the code below in a file called Library/custom_functions.php
<?php
function __($word=null,$just_return=false){
global $language;
//$language=$GLOBALS['registry']->get('language');
$word=$GLOBALS['registry']->get('language')->get($word);
if($just_return) return $word;
echo $word;
}
?>
Then include this file inside startup file as
require_once(DIR_SYSTEM . 'library/custom_functions.php');
And to use in the .tpl files
just use it as
__('entry_t('entry_description') etc etc ..
Hope this reduces your headache of setting up all the language variables in controller files and Opencart includes this in the next version
Attachments
A file to write all your custom functions and don't forget to include it in the startup.php file
Who is online
Users browsing this forum: No registered users and 21 guests