Skip to main content
fixed grammar
Source Link
Sobral
  • 6.1k
  • 17
  • 25

You're trying to use variables parsed at two different parsing stages on your code.

If there wasn't need to check member_group, you could use this:

{embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}

But you can't because, while last_segment is parsed at stage 5, member_groupis parsed at stage 26, even after the embed templates. So all the embeds are being parsed all the times and then being discarded.

Let's try to improve it a little bit. Be aware that cantyou can't to enable page caching on this, or members of different groups will see each others info.

{exp:switchee variable = "global:member_group" parse="inward"}
    {case value="5"}
        {embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}
    {/case}
    {case value="6"}
        {embed='mypassport/{if last_segment == "edit" }business-profile-edit{if:else}business-profile-view{/if}'}
    {/case}
{/exp:switchee}

If member_group wasn't a global variable, which needs the global prefix to be parsed early, we could test for both variables at once.


This is an interesting idea. I gonna suggest it to the developer of switchee, Mark Croxton.

You're trying to use variables parsed at two different parsing stages on your code.

If there wasn't need to check member_group, you could use this:

{embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}

But you can't because, while last_segment is parsed at stage 5, member_groupis parsed at stage 26, even after the embed templates. So all the embeds are being parsed all the times and then being discarded.

Let's try to improve it a little bit. Be aware that cant to enable page caching on this, or members of different groups will see each others info.

{exp:switchee variable = "global:member_group" parse="inward"}
    {case value="5"}
        {embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}
    {/case}
    {case value="6"}
        {embed='mypassport/{if last_segment == "edit" }business-profile-edit{if:else}business-profile-view{/if}'}
    {/case}
{/exp:switchee}

If member_group wasn't a global variable, which needs the global prefix to be parsed early, we could test for both variables at once.


This is an interesting idea. I gonna suggest it to the developer of switchee, Mark Croxton.

You're trying to use variables parsed at two different parsing stages on your code.

If there wasn't need to check member_group, you could use this:

{embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}

But you can't because, while last_segment is parsed at stage 5, member_groupis parsed at stage 26, even after the embed templates. So all the embeds are being parsed all the times and then being discarded.

Let's try to improve it a little bit. Be aware that you can't to enable page caching on this or members of different groups will see each others info.

{exp:switchee variable = "global:member_group" parse="inward"}
    {case value="5"}
        {embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}
    {/case}
    {case value="6"}
        {embed='mypassport/{if last_segment == "edit" }business-profile-edit{if:else}business-profile-view{/if}'}
    {/case}
{/exp:switchee}

If member_group wasn't a global variable, which needs the global prefix to be parsed early, we could test for both variables at once.


This is an interesting idea. I gonna suggest it to the developer of switchee, Mark Croxton.

Source Link
Sobral
  • 6.1k
  • 17
  • 25

You're trying to use variables parsed at two different parsing stages on your code.

If there wasn't need to check member_group, you could use this:

{embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}

But you can't because, while last_segment is parsed at stage 5, member_groupis parsed at stage 26, even after the embed templates. So all the embeds are being parsed all the times and then being discarded.

Let's try to improve it a little bit. Be aware that cant to enable page caching on this, or members of different groups will see each others info.

{exp:switchee variable = "global:member_group" parse="inward"}
    {case value="5"}
        {embed='mypassport/{if last_segment == "edit" }personal-profile-edit{if:else}personal-profile-view{/if}'}
    {/case}
    {case value="6"}
        {embed='mypassport/{if last_segment == "edit" }business-profile-edit{if:else}business-profile-view{/if}'}
    {/case}
{/exp:switchee}

If member_group wasn't a global variable, which needs the global prefix to be parsed early, we could test for both variables at once.


This is an interesting idea. I gonna suggest it to the developer of switchee, Mark Croxton.