Try this:
Code: Select all
class ControllerModuleModule1 extends Controller {
protected function index() {
$result = $this->getChild('module/module2');
}
}
My php is more better than my english.
You can find my Extensions here.
Look at the catalog/controller/common/home.php file
You'll note that it has no real content. But it calls its children, which are modules... but modules are just mini-controllers that don't call the output dispatch directly, because the main controllers do it.
But you can pretty much load any module and place it. The module name is its exported variable name "latest" module is called by "$latest", etc
You'll note that it has no real content. But it calls its children, which are modules... but modules are just mini-controllers that don't call the output dispatch directly, because the main controllers do it.
But you can pretty much load any module and place it. The module name is its exported variable name "latest" module is called by "$latest", etc
Qphoria wrote:Look at the catalog/controller/common/home.php file
You'll note that it has no real content. But it calls its children, which are modules... but modules are just mini-controllers that don't call the output dispatch directly, because the main controllers do it.
But you can pretty much load any module and place it. The module name is its exported variable name "latest" module is called by "$latest", etc
Thanks Q.
sv2109, came up with a nice solution.
But can anyone explane why ob_start() ignores?
But can anyone explane why ob_start() ignores?
Code: Select all
ob_start();
$this->getChild('checkout/cart/add'); // for some reason we have echo here
$result = ob_get_clean();
// $result = NULL
Hey Man. Don't Take Me Wrong, But...I Love Yousv2109 wrote:Try method getChild($route, $args) from /system/engine/controller.php

Saved my life. Thanks for the Tip.
Hi Q,Qphoria wrote:Look at the catalog/controller/common/home.php file
You'll note that it has no real content. But it calls its children, which are modules... but modules are just mini-controllers that don't call the output dispatch directly, because the main controllers do it.
But you can pretty much load any module and place it. The module name is its exported variable name "latest" module is called by "$latest", etc
This getChild() method can call a child.
But how do I call the Child's methods and pass variables to the methods from the calling controller?
In OpenCart 2.0.x versions, this is quite simple:
This will execute the action specified by the route, with the optional given args, and returns the rendered output.
Code: Select all
$this->load->controller( $route, $args );
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Who is online
Users browsing this forum: No registered users and 9 guests