freshJet Posted February 8, 2013 Report Posted February 8, 2013 I have a custom module that is in the default form of: http://www.site.com/index.php/module I also have subs to this to make http://www.site.com/index.php/module/one But how can I extend beyond this to something like: http://www.site.com/index.php/module/one/two I tried putting it within an existing function (which is already within the index function of the module) but it directs it to the one before. It's hard to explain. Quote
Moderators Parkho Posted February 8, 2013 Moderators Report Posted February 8, 2013 is two a page or a variable? Quote
Tom Posted February 9, 2013 Report Posted February 9, 2013 IIRC: public function index($one, $two, ... $n){ // Then you can do something like switch($one){ case 'action': $this->functionForAction(); break; } } Or just pile it all into the index function Quote
freshJet Posted February 9, 2013 Author Report Posted February 9, 2013 Yeah I tried putting it in the index function, this is an example of what I tried: <?php class Module extends CodonModule { function index(){ bla bla bla } function one(){ $this->show('training/pageone.tpl'); function two(){ $this->show('training/pagetwo.tpl'); } } } Quote
freshJet Posted February 10, 2013 Author Report Posted February 10, 2013 So this would work for any function? Quote
Tom Posted February 10, 2013 Report Posted February 10, 2013 Yep... index is probably a bad example though as in that case it'll be looking for a function called one first. So using your example "one" would be the function name and two etc would be the vars it takes. Quote
freshJet Posted February 10, 2013 Author Report Posted February 10, 2013 Thanks, I'll try it. Once I remember what I needed it for. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.