January 23, 2012

Passing arguments to a HMVC Module method using an array

Question by joomlearner

While using the HMVC Component in Codeignitors, we can render a particular actions like this

echo modules::run('site/news/view', 1);

Here the 1 is the parameter send to the view method.

Now I have an array of parameters, which i need to pass to the function

$params = array(1, "latest", "desc"); //suppose this are the parameters I received dynamically some how and dont knows its length

Now, I need to send these parameters seperately as

echo modules::run('site/news/view', 1, "latest", "desc");

Like in other functions call_user_func_array() will not work at this case(I think).

Answer by Starx

Well, its not possible to make an existing function work the way you need (unless modified). You should code, the way THE FUNCTION ALREADY WORKS. If it does not work the way you need, modify the source if allowed, or else write you own version of it, or extend the main class, to fit your needs.

I could answer this question easy, but this time I will want you to do the same. I have answered your question before & just viewed your profile, 6 Questions (1 accepted) 0 answers and on most of the questions no input from your side. You don’t seem to do anything on your own.

You relying on this community to get your job done, which is so unfair. So UNLESS you show me some of your work, I refuse to answer.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!