Jump to content

Recommended Posts

Posted

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.

Posted

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

Posted

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');
	 }

}

}

Posted

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.

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