Hey,
I’m a little bit frustrated.
I’m trying to nest channel entries but everything I do seems wrong.
This is my code (shortened):
{exp:channel:entries limit="1" require_entry="yes"}
{embed="embeds/header"}
{title}<br>
{page_content}
{embed="partners/index"}
{embed="embeds/footer"}
{/exp:channel:entries}and the partner/index:
<div class="row">
{exp:channel:entries channel="partner_section"}
<div class="three columns">
<h1>{title}</h1>
{partner_bild}
</div>
{/exp:channel:entries}
</div>I need the outer channel tag to display the page content and the inner to display e.g. partners, portfolio, etc. But it doesn’t work and I really don’t know why.
Help 😊
I don’t see that you have a channel(s) specified for the outer channel tag. It appears that you are trying to create a relationship? If so, you might be better off using the relationship tag, or using a “search:” parameter.
Also, your “require_entry=”yes”” parameter mandates that the url has a valid entry ID or a valid URL title. Is this the case? If not, then you won’t get any results.
-jim
Well, the easy question to ask is do you have the embed called properly to the correct template-group/template?
Add in an entry_id=”xyz” parameter (substitute a known good entry_id for xyz) in the embedded template and do a “View Rendered Template” from the template once you’ve saved it with the new parameter. If you get expected results, then see if it will bring in that data in via the embed. If it does, then somehow your channel tag in the embed (or something else you’re not showing us) is blowing up the template and it’s not returning anything.
Bit of advice: if you don’t need to use an embed for all of your header, footer, etc. blocks, you might look at using Snippets, as they are more efficient.
-jim
Bit of advice: if you don’t need to use an embed for all of your header, footer, etc. blocks, you might look at using Snippets, as they are more efficient. -jim
Even if I use other snippets in the embed? I added a “header” snippet and it doesn’t render properly because of the missing snippets….
Add in an entry_id=”xyz” parameter (substitute a known good entry_id for xyz) in the embedded template and do a “View Rendered Template” from the template once you’ve saved it with the new parameter. If you get expected results, then see if it will bring in that data in via the embed. If it does, then somehow your channel tag in the embed (or something else you’re not showing us) is blowing up the template and it’s not returning anything. -jim
I did and it returns the proper entry when I click on “Zeigen” (German for “View Rendered Template”. But nothing on the page…and I’m pretty sure, I’m embedding the right template…
Screen: http://cl.ly/image/092U2j111n3z so embed=”partners/index” is right, or?
Strange thing is, when I delete the code (with the channel tag) and add some simple content like a string “e.g “Hello”) it displays the content properly.
Yes, you’re embedding the right template-group/template.
Are you saying you’ve got a snippet in the template you’re trying to embed? Try your template without it. Sometimes you have to get down to simple elements that work and then build up to find the source of the error.
You also could turn on:
CP Home -> Admin -> System Administration -> Output and Debugging Preferences
Turn on template debugging, and you will get some useful (hopefully) information there.
Yes, you’re embedding the right template-group/template. Are you saying you’ve got a snippet in the template you’re trying to embed? Try your template without it. Sometimes you have to get down to simple elements that work and then build up to find the source of the error. You also could turn on: CP Home -> Admin -> System Administration -> Output and Debugging Preferences Turn on template debugging, and you will get some useful (hopefully) information there.
I did, here’s the output http://marek-maras.de/ee/partner
This is actually my new site, just want to avoid posting some code, what I just can show you guys the complete site! 😉
This is the “important” output, I think: (0.061583 / 14.95MB) Tag: {exp:channel:entries channel="partner_section" entry_id="34"} (0.061638 / 14.96MB) Closing Tag Found (0.061672 / 14.96MB) Processing Tags (0.061694 / 14.96MB) Module Tag: Channel/entries (0.061706 / 14.96MB) Including Files for Plugins and Modules (0.061715 / 14.96MB) Files for Plugins and Modules All Included (0.061724 / 14.96MB) Beginning Final Tag Data Processing (0.061735 / 14.96MB) Calling Class/Method: Channel/entries (0.061856 / 14.96MB) -> Class Called: Channel (0.062118 / 14.97MB) -> Method Called: entries (0.063651 / 14.97MB) Returning No Results Content (0.063704 / 14.97MB) -> Data Returned (0.063733 / 14.96MB) - End Tag Processing -
Ok, when I go to:
http://marek-maras.de/ee/partners/index (calling your template directly), I get the following output:
<div class="row">
<div class="three columns">
<h1>Erik Teichert</h1>
http://placekitten.com/200/300
</div>
</div>notice the unparsed “partner_name” variable in your img tag (its still got the brackets around it).
That’s enough to blow up the returned data from the embed once it gets inserted into the outer channel tag. I’m not sure which channel that field belongs to, but it isn’t the partner_section channel. If it is a field in another channel in the surrounding channel tag, then most likely you have a parse error, and want to try something different.
Can you get your code to work without using embeds? If it won’t work in the same template, then it won’t work in an embed.
Well, I can’t. I deleted the outer channel entries tag and all other embeds and added the code from the “partners” template to the main template and nothing happend.
What could it be?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.