ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Variables through multiple embeds?

November 02, 2011 12:41pm

Subscribe [2]
  • #1 / Nov 02, 2011 12:41pm

    Matt Ellis

    51 posts

    Bonjour,

    How can I pass a variable through to an embed in an embed - eg:

    Home page has:

    {embed="embeds/.audio_listing" player_size="mini"}


    .audio_listing has:

    {embed="embeds/.audio_player" entry_id="{entry_id}"}


    Then I’m trying to add {embed:player_size} to .audio_player:

    <div class="jp-audio {embed:player_size}">


    Is this possible? Can’t get it to work.
    Any work arounds would be greatly appreciated.

    Thanks! : )

     

  • #2 / Nov 03, 2011 10:51am

    Kevin Cupp

    791 posts

    Hi Matthew,

    You’ll also need to add it as a parameter on your .audio_player embed, so that embed should look like this:

    {embed="embeds/.audio_player" entry_id="{entry_id}" player_size="{embed:player_size}"}

    Basically, the nested embed is out of scope and doesn’t have access to its parents variables, so you have to assign a new one.

    Let us know if this answers your question.

    Kevin

  • #3 / Nov 04, 2011 10:59am

    Matt Ellis

    51 posts

    Worked like a charm! Thank you sir.

  • #4 / Nov 04, 2011 11:48am

    Kevin Cupp

    791 posts

    Great to hear, Matthew. Come on back to the forums if you need any more assistance.

    Kevin

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases