5

I'm trying to set some mx_jumper content from within an {exp:channel:entries} tag, and then output it somewhere else on the page. The page is an entry page and available on a url such as:

 /blog/entry/the-blog-entry-url-title

I created a simple test page to eliminate anything that might interfere with the functionality, and the code looks as follows:

{exp:channel:entries channel="blog"}
    <h1>{title}</h1>
    {exp:mx_jumper:put name="test"}Move this content to outside the loop{/exp:mx_jumper:put}
{/exp:channel:entries}

{exp:mx_jumper:out name="test"}

The problem is, that the contents of the mx_jumper test content only shows up when the exp:mx_jumper:out tag is inside the {exp:channel:entries} loop.

Any ideas what could be wrong?

4 Answers 4

4

Did you try using out_global like so:

{exp:mx_jumper:out_global}

{exp:channel:entries channel="blog" limit="1"}
<h1>{title}</h1>
{exp:mx_jumper:put name="test"}Move this content to outside the loop{/exp:mx_jumper:put}
{/exp:channel:entries}

{/exp:mx_jumper:out_global}

{exp:mx_jumper:out name="test"}

or you could also do:

{exp:mx_jumper:out_global}

{exp:channel:entries channel="blog" limit="1"}
<h1>{title}</h1>
{exp:mx_jumper:put name="test"}Move this content to outside the loop{/exp:mx_jumper:put}
{/exp:channel:entries}

{exp:mx_jumper:out name="test"}

{/exp:mx_jumper:out_global}
6
  • Awesome, thanks Mel, this works 100%
    – user417
    Commented Nov 28, 2012 at 13:41
  • Great! Glad I could help.
    – Mel
    Commented Nov 28, 2012 at 14:01
  • Which of the examples actually worked? Did you try just one? Or did they both work? Commented Nov 28, 2012 at 15:14
  • 1
    John they should both work.
    – Mel
    Commented Nov 28, 2012 at 15:15
  • Is this because each nesting level gets parsed at the same time? (e.g. ALL 'parent' module tags get parsed first, then 'ALL' child module tags) EDIT - oh I see John explained this well below. Commented Nov 28, 2012 at 16:32
2

This is a parse order issue I believe. The parse order is a tricky thing to get right. I believe what's happening is that the parse order is hitting the outermost tags first, and then goes back and hits the inner layers. If you turn on your template debugging, you will be able to verify this by viewing the order in which the tags are parsed.

I have a funky trick I have used in the past to deal with this issue myself.

Surround the second tag (the out tag) with another plugin which doesn't manipulate the output. For example, look for the ifElse tag from Croxton. That puts the Mx Jumper "out" tag on the same nested level (one level) as the Mx Jumper "put" tag. Again, the plugin (or module tag) that you use doesn't matter as long as it doesn't change the output. This sounds funky, but it works!

Example:

{exp:channel:entries channel="blog"}
    <h1>{title}</h1>
    {exp:mx_jumper:put name="test"}Move this content to outside the loop{/exp:mx_jumper:put}
{/exp:channel:entries}

{exp:ifelse}
  {exp:mx_jumper:out name="test"}
{/exp:ifelse}
0

I'd also try adding limit="1" to your entries loop - if used as it is right now, it could be trying to set multiple jumper variables with a name of "test".

1
  • I initially had limit="1", with no effect sadly.
    – user417
    Commented Nov 28, 2012 at 12:45
0

Try adding parse="inward" on your {exp:channel:entries} tag. I've never used that plugin but it looks similar to stash, and the parse thing works 9/10 times.

1
  • I tried parse="inward", but it doesn't work. I also installed exp:stash as I suspected exp:ex_jumper could be to blame, however, seeing the same results with exp:stash.
    – user417
    Commented Nov 28, 2012 at 12:47

Your Answer

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