We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Nested Channel Entries Tags

Development and Programming

motorstormer's avatar
motorstormer
17 posts
11 years ago
motorstormer's avatar motorstormer

For some reason I can’t get this to work in EE. It is a channel entries tag nested within another. The syntax appears to be ok.

{exp:channel:entries entry_id="{embed:pageid}" dynamic="no"}

    ...
            <div class="subContent">
                {exp:channel:entries channel="examples"}
                    <h3>{example_header}</h3>
                    {example_description}
                    <a href="http://{example_link}">{example_link_text}</a>
                {/exp:channel:entries}
            </div>
    ...

{/exp:channel:entries}
       
Boyink!'s avatar
Boyink!
5,011 posts
11 years ago
Boyink!'s avatar Boyink!

What are you trying to do?

       
motorstormer's avatar
motorstormer
17 posts
11 years ago
motorstormer's avatar motorstormer

Nevermind, I just need to use {embed="subTemplate"} to effectively nest channel entries tags. Answered my own question. Thanks.

       
Boyink!'s avatar
Boyink!
5,011 posts
11 years ago
Boyink!'s avatar Boyink!

Just keep an eye on how many queries are being generated - there are typically better coding approaches than nested entries loops.

       
strudel's avatar
strudel
195 posts
11 years ago
strudel's avatar strudel
Just keep an eye on how many queries are being generated - there are typically better coding approaches than nested entries loops.

Hi, I was wondering what the better coding approaches are?

What I’m trying to accomplish: I’m doing an art gallery site and the front page should have the current exhibition info on it. If there is no current exhibition, a different layout with text/images coming from a different channel should appear. Is there a better way than nesting channel entries than this do you think?

Thanks in advance!

       
Boyink!'s avatar
Boyink!
5,011 posts
11 years ago
Boyink!'s avatar Boyink!

Depends on how you know if there is an exhibition or not..but sounds like a great case for some conditionals.

       
strudel's avatar
strudel
195 posts
11 years ago
strudel's avatar strudel

Basically, I’m just using {if no_results} to trigger the alternate front page info, and using an embed so it will work. Does that seem the way to go?

       
Boyink!'s avatar
Boyink!
5,011 posts
11 years ago
Boyink!'s avatar Boyink!

Thats the thing with EE…there’s probably 6 ways to go..😉 And anyone who says there is a ‘best practice’ is trying to sell you something.

If it works and the query counts/load times are acceptable then run with it.

       
strudel's avatar
strudel
195 posts
11 years ago
strudel's avatar strudel

Thanks for your (as usual) valuable insight!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.