Below is a simple example to get you started. It will rewrite of &action=ACTION_HERE&func=FUNC_HERE&id=ID_HERE into /ACTION_HERE/FUNC_HERE/ID_HERE structure. It doesn't do anything special beyond that and is a simple example that you could work from.
Global
Triggers: onBuildRoute
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
Code:
if ( ( $variables['var2'] !== 'cbactivity' ) || ( ! $variables['var4'] ) || ( ! isset( $variables['var4']['action'] ) ) ) {
return;
}
$action = $variables['var4']['action'];
unset( $variables['var4']['action'] );
$variables['var3'] = $action;
if ( isset( $variables['var4']['func'] ) ) {
$variables['var3'] = $variables['var4']['func'];
unset( $variables['var4']['func'] );
if ( isset( $variables['var4']['id'] ) ) {
$variables['var3'] = $variables['var4']['id'];
unset( $variables['var4']['id'] );
}
}
Parameters
References: Variable 3 and Variable 4
Global
Triggers: onParseRoute
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
Code:
if ( ( $variables['var2'] !== 'cbactivity' ) || ( ! $variables['var3'] ) ) {
return;
}
if ( isset( $variables['var3'][0] ) ) {
$variables['var4']['action'] = $variables['var3'][0];
if ( isset( $variables['var3'][1] ) ) {
$variables['var4']['func'] = $variables['var3'][1];
if ( isset( $variables['var3'][2] ) ) {
$variables['var4']['id'] = $variables['var3'][2];
}
}
}
Parameters
References: Variable 4
I'm still unsure how well this will work using CB Auto Actions though. It's possible CBs Input object may initialize too early using this and cause problems. Routing really wasn't intended to be used outside of a plugins core PHP.