0

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).

2 Answers 2

1

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.

0

I created a "seo front controller" and I (brutally) resolved the same problem in ths way

if( count($params) == 2 ) {
    echo modules::run( 'controller/method', $params[0], $params[1] );
} else if( count($params) == 3 ) {
    echo modules::run( 'controller/method', $params[0], $params[1], $params[2] );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.