7

I am using EE's next_entry tag to link to the next entry, and then using a stash/switchee combination to evaluate if we are at the last entry in the loop and if so use a channel entries loop to display the first entry.

Everything works fine and it does what I expect with the following code.

But when I turn on EE's template caching, I get a random string as follows:

{6ee64145dfa4ae5926a9c326266d5954499133923}

The problem seems to be inconsistent as this doesn't happen all the time. Template caching right now is at 60 minutes, but after clicking around a bit the string appears occasionally every few minutes and I haven't found a pattern to the issue.

Here's the block of code I'm using:

{exp:channel:next_entry channel="video" url_title="{segment_2}" orderby="date" sort="asc"}

  {!-- If next_entry doesn't run then we are at the end of the loop so this stash won't be set --}
  {exp:stash:set name="st_next_entry"}next{/exp:stash:set}

  <span>Next: </span>
  <a href="{path='{segment_1}'}">
    {title}<span> &rsaquo;</span>
  </a>
{/exp:channel:next_entry}

{exp:stash:parse process="end"}
  {switchee variable="{exp:stash:get name='st_next_entry' random}" parse="inward"}

    {case value="next"}
      {!-- Do Nothing, link to next entry is already displayed --}
    {/case}

    {case default="yes"}
    {!-- Display start entry link, because the next_entry loop didn't run so stash value was left empty --}

      {exp:channel:entries channel="video" dynamic="no" disable="categories|category_fields|member_data|pagination" status="open" limit="1" sort="asc"}
        <span>Next Video: </span>
        <a href="{url_title_path='{segment_1}'}">
          {title}<span> &rsaquo;</span>
        </a>
        <br />
      {/exp:channel:entries}

    {/case}
  {/switchee}
{/exp:stash:parse}

I'm guessing that the {6ee64145dfa4ae5926a9c326266d5954499133923} string is actually a placeholder of some sort and that the template parser isn't getting around to filling in the proper value when I turn on the template caching.

Thank you for any assistance you can provide.

Also, if someone knows their way around EE's native tag caching options and how to use the cache="yes" refresh="60" parameters. Are they only for EE native tags, or can it be used across the board for any exp: tag, including also related_entries/reverse_related_entries tag pairs and the output of 3rd party plugins?

  • oliver
2
  • the ee docs say tag caching can be using with any tag, but that is any EE tag, a 3rd party add-on would have to be built to accept a cache param ellislab.com/expressionengine/user-guide/optimization/…
    – mjr
    Commented Mar 28, 2013 at 16:17
  • Has anyone seen anything like this that would give me a clue as to what is going on? Thank you... Thanks mjr, wasn't too clear on that but I suppose if I can cache any EE tag then that will help with getting faster page loads.
    – oliverb
    Commented Mar 30, 2013 at 15:46

1 Answer 1

3

For anyone that has encountered this same issue, Mark Croxton was able to solve the issue at the devot-ee support forum.

Essentially, wrapping the next_entry tag pair with a stash parse tag like so {exp:stash:parse}....{/exp:stash:parse} on the first code block solves the issue.

Full support thread: http://devot-ee.com/add-ons/support/stash/viewthread/9131

Your Answer

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

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