I’m having trouble with the code below. I’ve simplified it to illustrate the point.
Basically, I want to check the URL in case it’s carry variables I need to act upon. For example:
1. website.com/template_group/template/client/client_name
Here I detect that there is a name/value pair: client = client_name. So now I know what the client’s name is I can bring back that client’s data.
2. website.com/template_group/template/order/title/client/client_name
Here there is another variable pair in the URL which I also want to detect and act upon. But notice the client name variable pair is in different segments of the URL.
So, I want an IF statement that checks the different segments and sets a known variable. See a basic example here:
{if segment_3=="client"}
{preload_replace:client_url_title="{segment_4}"}
{/if}
{if segment_5=="client"}
{preload_replace:client_url_title="{segment_6}"}
{/if}
{embed="includes/client_work_list" client_url_title="{client_url_title}"}Notice I am trying to store the client name in to some kind of container (here I use the preload_replace variable “client_url_title”) in order to reuse that container in the embed code at the end. But this doesn’t work! Because the second preload_replace call OVERWRITES the first one regardless of whether the second IF statement fired.
This seems to be the case for MX_Jumper plugin too (which offers a way to reuse “variables” in a template).
Is there any way to do this? It seems like a pretty obvious thing to do so I think I’m missing a trick here!