0

Currently I have a a channel page entry that then goes through a playa of secondary entries. I'd like to pass some of the parent's data like page title and description to the embdeds.

My code looks similar to this:

{exp:channel:entries}
    {exp:playa:children field="content"}
            {embed="some_widget" entry_id="{entry_id}" variable="{title}" description="{description}"}
    {/exp:playa:children}
{/exp:channel:entries}

I'd like to pass my embed:

{exp:channel:entries entry_id="{embed:entry_id}"  title="{title}" description="{description}"}
    <!--test-->
    {title}
    <br>        
    {description}           
{/exp:channel:entries}

Right now, it does embed the widget. But none of the information is passed along.

2

You don't have the embed syntax quite right. Passing {embed:entry_id} is correct, as that tells the channel:entries tag which entry to load. But there are no channel:entries parameters called title or description.

Instead, simply use them in the same way you used {embed:entry_id}.

Also - in your example, {title} will actually be the title of the child entry, not the parent. To use the parent's title inside of the Playa tag, use a var_prefix on playa:children - this will prevent {title} from being replaced by Playa.

So your ending code:

{exp:channel:entries channel="foo"}
    {exp:playa:children field="content" var_prefix="widget"}
            {embed="some_widget" entry_id="{widget:entry_id}" title="{title}" description="{description}"}
    {/exp:playa:children}
{/exp:channel:entries}

Then in your embed:

{exp:channel:entries entry_id="{embed:entry_id}" dynamic="no"}
    <!--test-->
    {embed:title}
    <br>        
    {embed:description}           
{/exp:channel:entries}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.