1

Busy developing some custom modules for EE. Everything is going swimmingly, except I can't seem to find any documentation on how to filter results in my modules tags.

What I am looking to achieve is something like:

{exp:my_mod:my_func month="June"}
    ...
{/exp:my_mod:my_func}

My hope is to filter results here and only show results for the month of June, rather than doing this filtering in the .mod file. Is this a simple thing to achieve of should I just do it manually on the back end (which would mean creating 12 separate modules)

5
  • You certainly shouldn't use 12 separate modules, that's for sure. Are you looking for way to specify the month in your template? Unless I am misunderstanding you, isn't that just a simple parameter you're handing off to your module? – Ingmar Dec 7 '15 at 9:37
  • Yeah, definitely the wrong approach to create 12 separate modules, thats why I ran to StackExcahnge for help! :) I think it is a parameter to hand over, but not sure how I do that... (new to EE dev) – Sydcpt Dec 7 '15 at 9:40
  • I am not a programmer, but I think ee()->TMPL->fetch_param('param_name'); should do the trick. Have you checked out the docs at ellislab.com/expressionengine/user-guide/development/index.html ? – Ingmar Dec 7 '15 at 9:48
  • For not being a programmer, you just saved my life. Was able to search fetch_param and implement a working solutions. Thank you so much. If you want to answer, I will mark as correct! – Sydcpt Dec 7 '15 at 9:54
  • Cool! I've just put that in a reply, perhaps others might find it useful, too. – Ingmar Dec 7 '15 at 10:01
1

It's a common function functionality of addons to use parameters, so there's an EE function for that:

ee()->TMPL->fetch_param('param_name');

Check out the docs if you need an example and more info.

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.