Hi gang,
I'm new to opencart and am trying to understand how this works. Can someone explain this for me?
Very simple example... In the footer of Opencart you see the text: "Powered By OpenCart
Your Store © 2011 | OpenCart Hosting"
When I look in view/theme/default/template/common/footer.tpl - I see where it's outputted fromecho $text_powered_by;
I thought that the variables used in the template files came from the controller. When I look in the footer.php controller, there is no $this->data['text_powered_by'] like I thought I would see. However, if I look in the language folder, I do see $_['text_powered_by'] = 'Powered By <a href="http://www.opencart.com">OpenCart</a><br /> %s © %s';
Can anyone elaborate on what's going on here? Does the language file also create a variable for use inside the view/template .tpl file?
And if so, in this instance, where does the text "Your Store" and "2011" come from, where it says %s in the actual string text for the variable inside the language footer.php file.
I hope that makes sense.
Thanks in advance for your help!
catalog/language/english/common/footer.php:
catalog/controller/common/footer.php:
catalog/view/theme/default/template/common/footer.tpl
The sprintf function replaces all "%s" found in the language variable with the eval data specified with each comma in the function
Code: Select all
$_['text_powered_by'] = 'Powered By <a href="http://www.opencart.com">OpenCart</a><br /> %s © %s';
Code: Select all
$this->data['text_powered_by'] = sprintf($this->language->get('text_powered_by'), $this->config->get('config_name'), date('Y', time()));
Code: Select all
<?php echo $text_powered_by; ?>
Who is online
Users browsing this forum: No registered users and 12 guests