1

EE 2.10.1 Stash 2.6.5

I'm trying to set up some shortcodes using Stash on a rebuild of my site where I formally was using MX Jumper to do the same thing.

The code works fine except that the last instance of the shortcode always outputs home on the front end inexplicably

My code is where {code_sample} is a grid field:

{!--
    //Stashing code blocks to inject into blog_copy
--}


{code_sample}
    {exp:stash:set name="code_block_{code_sample:count}" type="snippet"}

            {code_sample:code}

     {/exp:stash:set}
{/code_sample}

{!--
    //End Stashing code blocks
--}

Then further down the template:

{exp:stash:parse process="end"}
    {blog_copy}
{/exp:stash:parse}

If there is more than one code block then the final code block always renders as home.

Any thoughts?

--------update---------

Template debugging shows this as the final output, which is correct but still on the front end it displays "home"

(0.195359 / 8.31MB) Stash: SET code_block_9 to value {exp:ee_syntax:filter} <pre lang="php" line="3257"> $field_id = $this->get_field_id($field_name); ee()->api_channel_fields->apply('_init', array(array( 'row' => $this->entry, 'content_id' => $this->entry('entry_id'), 'field_id' => $field_id ))); </pre> {/exp:ee_syntax:filter}

Also if I put this code in the template without stash all grid rows are output correctly

{code_sample}

        {exp:ee_syntax:filter}
            {code_sample:code}
        {/exp:ee_syntax:filter}

        <br><br><br>

{/code_sample}

-----end update-------

-----update 2-------

Working with a new template with nothing in it but the layout tag and channel entries I have determined that this stash code does not play well when passing variables through the layout tag like this:

{layout="site/_layout" body_id="home"}

or

{layout:set name="body_id"}blog{/layout:set}

Using either of those results in the final code block outputting whatever is being passed through in the layout tag. Changing the passed variable name doesn't fix this issue either. Not sure if this is a Stash bug or an EE bug or both...

-----end update 2-------

1 Answer 1

2

This turned out to be a bug in the Template class:

https://support.ellislab.com/bugs/detail/21054

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.