Search code examples
javascriptexpressionengine

Embed Templates based on GET Parameters in the URL


say I have a url like www.site.com/lp?action=workspace

In expression engine, can i do something like

if action=workspace{

{embed="landing/form"}

}

??


Solution

  • Yep.

    Download and use Mo' Variables.

    {if "{get:action}" == "workspace"}
      {embed="landing/form"}
    {/if}
    

    Or if it's a submitted form, POST it instead:

    {if "{post:action}" == "workspace"}
      {embed="landing/form"}
    {/if}
    

    But you could consider utilising segments:

    www.site.com/lp/workspace

    {if "{segment_2}" == "workspace"}
      {embed="landing/form"}
    {/if}