6

How can i effectively add a custom parameter for the function {loadmodule mod_name}. Something like:

{loadmodule mod_video_player src="0Bmhjf0rKe8" start="5" end="20"}

Any ideas? Thanks!

6

Don't use loadmodule actually. You have to make your own plugin based on it.

Copy the loadmodule plugin from plugins/content/loadmodule to another folder (probably plugins/content/video_player based on your question). We will use it as a base, but change how it loads things.

I would then trigger the module with code like the following:

{video_player src="0Bmhjf0rKe8" start="5" end="20"}

You would then need to adjust the regex (and remove one, since you only have one trigger) to be like so:

// Expression to search for(modules)
$regexmod   = '/{video_player\s(.*?)}/i';
$stylemod   = $this->params->def('style', 'none');

Finally, you would need to adjust all of the processing (and this part is on you to try) so that it processes the matching string (which will be all your settings) and returns a video player with those settings, like how the current plugin returns the loaded module.

You can either actually load the module and pass it settings or place the code for the video player in the plugin.

1

If you are not a developer to make your own plugin then its best to use nonumber, really simplifies things like this.

http://www.nonumber.nl/extensions/modulesanywhere/userguide

It is a pro only feature but it allows you to adjust settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.