Hi,
I am trying to have the object that is created in a modules manage() method available in a module I have created.
In my new module, I have written a sql query which generates part of the view I want, however for the other part of the view, it seemed efficient if I could just pull in the object that the manage() method when it returns $data['rows]
I have tried using various statements using
$this->module('module_name');
but with no success.
I am sure it is very simple, but the solution is evading me.
Get data from another module
4 years ago
4 years ago
#1
4 years ago
#2
Hello,
Your syntax is correct to call another module
Are you then calling the method name?
The other thing is the method Private, Public..
Dan
Your syntax is correct to call another module
Are you then calling the method name?
The other thing is the method Private, Public..
Dan
4 years ago
#3
I created a function in my controllers file called index(), where I have got my sql query and passing the data into my view file.
I then wanted to get the date from the module called 'priorities' so I can also pass this to my view file. To try this, I created a new function before the index() function called test(). I will of course make this a private function eventually. If I add the slug /test/ I can see the full /manage/ view - so this is good. But I only want the object $rows , so I can pass this into my view file.
class Homepage extends Trongate {
function test(){
$this->module('priorities');
$rows = $this->priorities->manage();
}
function index(){
$this->module('trongate_security');
$this->trongate_security->_make_sure_allowed();
$sql = ' this is my sql query which I then pass into my view template';
$data['view_module'] = 'homepage';
$data['view_file'] = 'homepage_content';
$this->template('admin', $data);
}
}
I then wanted to get the date from the module called 'priorities' so I can also pass this to my view file. To try this, I created a new function before the index() function called test(). I will of course make this a private function eventually. If I add the slug /test/ I can see the full /manage/ view - so this is good. But I only want the object $rows , so I can pass this into my view file.
class Homepage extends Trongate {
function test(){
$this->module('priorities');
$rows = $this->priorities->manage();
}
function index(){
$this->module('trongate_security');
$this->trongate_security->_make_sure_allowed();
$sql = ' this is my sql query which I then pass into my view template';
$data['view_module'] = 'homepage';
$data['view_file'] = 'homepage_content';
$this->template('admin', $data);
}
}
4 years ago
#4
4 years ago
#5
Many thanks,
silly oversight on my part.
silly oversight on my part.
4 years ago
#6
Hit the star button!
Your welcome I do that more often that not
Your welcome I do that more often that not
4 years ago
#7
Just to let you know, when you're posting code it can look a bit easier on the eyes if you use code tags.