Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting variable in layout not passing value from child template #181

Open
GitTworn opened this issue Jul 3, 2023 · 0 comments
Open

Setting variable in layout not passing value from child template #181

GitTworn opened this issue Jul 3, 2023 · 0 comments

Comments

@GitTworn
Copy link

GitTworn commented Jul 3, 2023

In the global (most outer) layout I would like to get some member variables and pass them on the a template that uses.

_global_layout

{if logged_in}
    {exp:stash:set scope='user' parse_tags='yes' save="yes"}
        {exp:visitor:details}
            {stash:st_logged_in_member_gender}{visitor:member_gender}{/stash:st_logged_in_member_gender}
            {stash:st_logged_in_member_first_name}{visitor:member_firstname}{/stash:st_logged_in_member_first_name}
            {stash:st_logged_in_member_last_name}{visitor:member_lastname}{/stash:st_logged_in_member_last_name}
            {stash:st_logged_in_member_email}{visitor:username}{/stash:st_logged_in_member_email}
        {/exp:visitor:details}
    {/exp:stash:set}
{/if}

In a child template I want to use them.

_newsletter_form
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="First name" value="{if {exp:stash:not_empty name='st_logged_in_member_first_name'}}{exp:stash:get name='st_logged_in_member_first_name'}{/if}">
OR
<input id='radio-mr' type="radio" name="gender" value="male" {if '{stash:embed:st_logged_in_member_gender}' == 'male'}checked="checked"{/if}> <--- does not work either

This is not working.

When I use {stash:embed:st_logged_in_member_first_name} it does give me the correct value, however I can't seem to get it to work with a conditional.

@GitTworn GitTworn changed the title Setting variable in layout not passing value to child Setting variable in layout not passing value from child template Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant