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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
sirber
Forum Members
Forum Members
Posts: 12
Joined: Tue Apr 24, 2012 2:41 pm
Location: Québec, Canada

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

Post 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!
sirber
Forum Members
Forum Members
Posts: 12
Joined: Tue Apr 24, 2012 2:41 pm
Location: Québec, Canada

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

Post 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" }
:(
sirber
Forum Members
Forum Members
Posts: 12
Joined: Tue Apr 24, 2012 2:41 pm
Location: Québec, Canada

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

Post 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!
Post Reply

Return to “Developers Discussion”