Jump to content

Developing A Module - How to use __remap function?


Sonad

Recommended Posts

Hi everyone,

I am developing some addons for phpvms using codon framework.

I have a question for you who are developers.

How can we use __remap() function? Is there a __remap() function in codon framework like CodeIgniter?

If there isn't, i really think that will be wonderfull.

Best regards,

Link to comment
Share on other sites

My understanding is you want to handle calls to the module (class) for routes (functions) that might not exist? That right?

codon itself might not have anything, but PHP has __call?

public function __call($name, $args) {
   // ...
}

where $name is the first regular variable of your route: index.php/module/var/...

and $args is an array containing all the rest: index.php/module/var/arg/arg/...

This isn't so much remapping as handling calls to functions that don't exist, so if you visit index.php/module/action and function Module::action() exists, it will only call that function, not __call.

Link to comment
Share on other sites

Thanks for reply,

I want to get my variables directly to index function in my module.

For example;

www.mydomain.com/mymodule/123

I observed some modules (such as download) but they all dont use it.

For example download module uses the dl function to get variables.

Link to comment
Share on other sites

Thanks for reply,

I want to get my variables directly to index function in my module.

For example;

www.mydomain.com/mymodule/123

I observed some modules (such as download) but they all dont use it.

For example download module uses the dl function to get variables.

Do you want vars on your index as well as other functions? Or is that it?

Either way you'll just have to write some logic in __call to deal with the various possibilities.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...