trOnGAtE
switch to dark mode

Accessing Sub Modules From Other Modules
From Controllers
To call (invoke) a sub module from another Trongate module (that's any other kind of Trongate module!) we simply continue with our 'parent with a hyphen' policy when we are loading our sub modules. Once the sub module class has been successfully loaded, we no longer need to reference the parent module when invoking methods from the sub module.
Below is an example of our display() method - inside 'accessories' - being called from within our 'cars' module:
<?php
class Cars extends Trongate {
function index() {
$this->module('cars-accessories');
$this->accessories->display();
}
}
?>
From Views
Sub modules may be called from view files by following our convention of referencing the parent followed by a hyphen, when calling our sub modules. For example:
<?= Modules::run('cars-accessories/display') ?>
HELP & SUPPORT
If you have a question or a comment relating to anything you've see here, please goto the Help Bar.