Hi Guys,
I am having a weird issue.
So I have two Channels A & B. I am using an embed to associate channel A & B together. So if Channel A & Channel B both have the same category, the code should pull an entry from Channel B into Channel A. For some weird reason, the channel entry tag in the embed code is running the exact number of times as the number of entries in channel A.
Here is my code
//Main Template
{exp:channel:entries channel="a" limit="1" dynamic="no"}
{embed="_inc/test2" cat_id="18" }
{title}
{/exp:channel:entries}
//Embed Code test2.html
{exp:channel:entries channel="b" status="open" category="{embed:cat_id}" limit="1"}
Test
{/exp:channel:entries}
//Result
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test
Winter
As you can see, I am getting 36 instances of the word Test and there are exactly 36 items in the channel A.
The weird thing is that the code seems to work perfectly if I test it in another install of EE I have running. I have no idea what could be causing it to misbehave.
Yes, if I remove the category parameter from b, I get only one test output. However, shouldn’t the limit=”1” ensure only one test output is returned regardless of if the category parameter is matched or no? The idea is that is it is matched it pulls the right related entry, if not, it pulls a random entry from the B Channel.
Tried it locally and seemed to work like you’re hoping, so maybe something else is interfering? I would check with test templates minimal as possible, test channel ‘b’ embed outside of an embed with hard coded id, make sure no “invisible” characters are in the text, check individual templates preferences, etc… Sorry I’m not seeing anything else obvious I might help with.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.