i edit the code at catalog/controller/extension/ but the file i edit dont have any effect at frontend, even if i del all the code
for example i write a code $data['abcd']="DDD"; to test the source
but at twig theme i write {{abcd}} dont have any respone
but i del the file will display error
may i know what happen?
Editing the controller alone does not pass data to the front-end; the controller passes data. You then have to call the data the controller is passing.
Say you make the change in your controller, like so:
You have to edit the corresponding template file (aka 'the view' part of MVC) to call it:
To know what view file to edit, you can either (in most cases) assume it's the corresponding path of the controller file you're editing:
Controller: admin/controller/common/header.php
View: /admin/view/template/common/header.tpl
or consult the function you're currently editing, inside the controller:
If you're editing the following function in header.php:
Look for the closure of this function, it will have a line like this:
..which tells us the template file is common/header.
The framework automatically fills the file path (/admin/view/template/common/header.tpl) -- the surriounding filepath is always consistent. so when you're looking at the $this->load->view you can always 'fill in the blanks' with view/template/common/header.tpl
Say you make the change in your controller, like so:
Code: Select all
$data['mytest'] = 'this is my test';
Code: Select all
<?php echo $mytest; ?>
Controller: admin/controller/common/header.php
View: /admin/view/template/common/header.tpl
or consult the function you're currently editing, inside the controller:
If you're editing the following function in header.php:
Code: Select all
public function index() {
Code: Select all
return $this->load->view('common/header', $data);
The framework automatically fills the file path (/admin/view/template/common/header.tpl) -- the surriounding filepath is always consistent. so when you're looking at the $this->load->view you can always 'fill in the blanks' with view/template/common/header.tpl
Extensions I've made (free):
Breadcrumbs for 2.3.0.2 & 3.0.2.0 Breadcrumb links for subcategories & parent category on product pages
Product Requests Allow customers to request notifications for sold out products
Abandoned Carts Send inquiries to abandoned carts to complete checkout or provide feedback
Ghost Orders Cleanup residue left behind by one page checkout addons
Who is online
Users browsing this forum: No registered users and 34 guests