1

I'm having a bit of an issue in repurposing a functioning template of mine. I have a {exp:stash:set} and {stash:get tag}, both of which worked on the previous template, but on this new template which is on a Structure page one segment deeper, I seem to be having problems with the {exp:stash:get} not returning anything, though the set tag works just fine with output='yes' set.

The code in question:

{exp:stash:set name="segment_entry" type='snippet' parse_tags="yes"}
  {exp:playa:parents url_title="{freebie_6}" channel="segment_discussions"}
    {entry_id}
  {/exp:playa:parents}
{/exp:stash:set}

{exp:channel:entries
    channel="segment_discussions"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    limit="1"
    entry_id="{exp:stash:get name='segment_entry' type='snippet'}"
    parse="inward"
  }

I’ve tested to see if the problem was the get tag being inside of the {exp:channel:entries} tag, but unfortunately, that doesn't seem to have any effect. Is there anything else I’m missing that could cause this to no longer function? channel name obviously is correct, as I previously mentioned that output='yes' was working just fine.

For reference, here is the whole template, with content of other switchee cases removed:

{if logged_out}{redirect="account/login"}{/if}
{if group_id == '4'}{redirect="account/pending"}{/if}

{exp:switchee variable="{freebie_4}" parse="inward"}
  {case default="yes"}
  [[Unrelated Content]]
  {/case}

  {case value="discussion"}
    {switchee variable="{freebie_5}" parse="inward"}
      {case value="thread"}
        {embed="embeds/_header"}

        {exp:stash:set name="segment_entry" type='snippet' parse_tags="yes"}
          {exp:playa:parents url_title="{freebie_6}" channel="segment_discussions"}
            {entry_id}
          {/exp:playa:parents}
        {/exp:stash:set}

        {exp:channel:entries
            channel="segment_discussions"
            disable="categories|category_fields|member_data|pagination|trackbacks"
            limit="1"
            entry_id="{exp:stash:get name='segment_entry' type='snippet'}"
            parse="inward"
          }

            <section class="unit">

            {embed="unit/_navigation"}

            </section>

            <section class="discussion">

              <div class="main-content">

                <header>

                  <h3>DISCUSSION: {title}</h3>

                  <h4>{comment_total} Comment{if comment_total <> 1}s{/if}</h4>

                </header>

                <article>

                  {segment_discussion_body}
                  {exp:channel_files:files entry_id="{entry_id}"}
                    {if file:count == "1"}<ul>{/if}
                    <li>{file:title}: <a href="{file:url}">{file:filename} ({file:filesize})</a></li>
                    {if file:count == file:total}</ul>{/if}
                  {/exp:channel_files:files}
                </article>

              </div>
        {/exp:channel:entries}

              <div class="discussion-items">


              </div> <!-- discussion-items -->

            </section>


        {embed="embeds/_footer"}
      {/case}
    {/switchee}
  {/case}
{/exp:switchee}
  • have you tried without type="snippet" and or added process="end" to the get? – Natetronn Jan 30 '13 at 3:26
  • Yes to both accounts, Nate. No dice yet. :( – Christopher Kennedy Jan 30 '13 at 4:11
  • yeah, sorry, that wouldn't really make sense now that look over the parse order pdf again. – Natetronn Jan 30 '13 at 4:28
2

So the grand and magnificent Mark Croxton let me know that the problem in this example is my use of line breaks, which are being passed into the parameter values and choking EE. I removed them from the template, but he also said that either {exp:stash:set} or {exp:stash:get} could have the paramater trim="yes" added to it to clear out the extra whitespace.

In the end, collapsing it to one line fixed it all.

| improve this answer | |
  • Grand and magnificent Mark "The Croxton" indeed is ;o) – Jérôme Coupé Jan 30 '13 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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