Page 1 of 1

inline module inside {content} with a different $action?

Posted: Wed Apr 25, 2012 1:43 pm
by sirber
Hi!

I have a template with {content}, a content page with a layout which in it load a module using {cms_module module='sbCarriere'}. The module loads and it works. In DoAction(), $action == "default".

I'd like to use the same content page with a different action for the module.

I tryed:
?page=carriere&action=myaction -> same as "default"
?page=carriere&id=test&action=testmyaction -> empty {content}
?page=carriere&mact=sbCarriere,cntnt01,myaction,1 -> shows only the module in {content}

I could override $action in DoAction() if I see a variable in $_GET, but is there an "official" way to do this?

Thanks!

Re: inline module inside {content} with a different $action?

Posted: Wed Apr 25, 2012 4:42 pm
by sirber
with JoMorg's help, I got:

Code: Select all

function SetParameters() {
		$this->RegisterModulePlugin(); // to be able to use {sbCarriere} instead of {cms_module sbCarriere}
		
		/* */
		$this->RegisterRoute('&sbc_action=(?P<sbc_action>[a-zA-Z]+)$/');
		
		/* Security */
		$this->RestrictUnknownParams();
		$this->CreateParameter('sbc_action','','help');
		$this->SetParameterType('sbc_action',CLEAN_STRING);
	}
but with the url: index.php?page=carriere&sbc_action=jobview

I get:

Code: Select all

var_dump($action, $params);
string(7) "default" array(2) { ["module"]=> string(10) "sbCarriere" ["action"]=> string(7) "default" }
:(

Re: inline module inside {content} with a different $action?

Posted: Wed Apr 25, 2012 5:18 pm
by sirber
got it!

Code: Select all

$this->smarty->assign('job_view', $this->CreateFrontendLink($id, $returnid, 'job_view', 'test'));
which makes:

Code: Select all

index.php?mact=sbCarriere,m5969d,job_view,1&m5969dreturnid=78&page=78
the template from my content page stays, only the module parts updates

win!