Extension, Plugin

Developer
Supported

In

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Causing Effect

     

You must be logged in to post.

Does this add-on allow you to put an entries loop in an entries loop without an embed?

Support (Resolved)

QB Marketing
QB Marketing

Hi CE folks - simple question - if I have an entries loop, and I want to, inside that entries loop, include the content of another channel, until now, I’ve had to use an embed (or some fancy stashing) to put the inner entries loop in place.  Does this add-on allow me to do the same thing without the weight of an embed?

Causing Effect - Aaron Waldon
# 1
Developer
Causing Effect - Aaron Waldon

Hi QB Marketing!

If the issue you are experiencing in the need to nest a Channel Entries loop inside of another Channel Entries loop, you may want to try VMG Nested.

The Insert method of this add-on will include a template in the current template, as if it were part of the template to begin with (think snippet). The Include method of this add-on is very similar to an embed, but it happens a lot sooner, and is not as process intensive as an embed.

Does that make sense?

QB Marketing
# 2
QB Marketing

Sounds like the include method might be what I’m after. Basically my approach, in a simplified manner, is this - within my “pages” channel (using regular entries and not the pages module) I commonly have a “components” field, in which the admin may select from a list of pre-set chunks of content to be inserted at a given point in the page (usually with a body field before it and an extended body after it).  A component might be “staff list” for example. Staff has its own channel and its own channel fields.  Because of that, I wound up with a channel entries loop for the page, with an inner loop conditionally inserted on the basis of “staff list” being selected, for which i used switchee to do the case logic on which selection in the components field was made and therefore which of the embeds to place into that position.  I was not passing any data, so the embed was really only being used to get around the nested entries limitation.  It sounds like your include method might do the trick for me as long as it is parsed later than the switchee case logic - because I only need the embed (or include) parsed when the relevant component has been selected.  And if the include would work, and is lighter than the embed, that might be an ideal solution for me.

I suppose VMG solution might work too, with the nested entries loop being in a snippet instead of an embed to reduce overhead and parse it as though it was inline, but I wonder if the conditionals within the nested loop would present any issues.

Causing Effect - Aaron Waldon
# 3
Developer
Causing Effect - Aaron Waldon

It sounds like your include method might do the trick for me as long as it is parsed later than the switchee case logic

It is included very early, like a snippet. If including your code in a snippet within switchee would work, then this would too. However, nested channel entries loops generally do not work, unless using VMG Nested.

If you are using the same logic for the cases in multiple places, it might make sense to move them to their own template, so that they can be easily included with In. Otherwise, you could probably just keep them in the switchee tag using VMG Nested. :)