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

Embed replicating output

How Do I?

T Adams's avatar
T Adams
36 posts
8 years ago
T Adams's avatar T Adams

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.

       
travisb's avatar
travisb
171 posts
8 years ago
travisb's avatar travisb

Are you sure 18 is the category id? If you take off the category parameter in ‘b’ do you get only 1 ‘Test’ output?

       
T Adams's avatar
T Adams
36 posts
8 years ago
T Adams's avatar T Adams

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.

       
travisb's avatar
travisb
171 posts
8 years ago
travisb's avatar travisb

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.

       
T Adams's avatar
T Adams
36 posts
8 years ago
T Adams's avatar T Adams

Yeah. I might have to rebuild everything. I feel like there is a bug in there somewhere that is causing the issue. Drove me slightly crazy for a few days thinking my coding was wrong :(

       

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.