0

I would like to know about the usage of {embed:entry_id}.

It is used in case an entry_id is inside an embedded template?

There are other usages?

2

Example 1:

In some cases {embed:entry_id} would be most useful by passing an entry_id from the parent template into the embeded one's entries tag pair entry_id parameter to just return the results of the given entry_id.

{exp:channel:entries channel="your_channel" entry_id="{embed:entry_id}"}
     Just the entry that was passed from the parent template.
{/exp:channel:entries}

Example 2:

In some cases you might want to pass multiple entry_ids into the entry_id parameter. Some might use an channel loop to output #|#|#|#|# into the the {embed:entry_id} variable. That would display multiple entries in the child template.

{exp:channel:entries channel="your_channel" entry_id="#|#|#|#|#"}
     Just the entry that was passed from the parent template.
{/exp:channel:entries}
1
  • Thanks for your explication, it's exactly what i needed! – Stéphane Mar 25 '14 at 20:31
2

In simple terms, that is how you call up the value of a variable declared within an embed tag. So for example, if in your "main" template, you insert an embedded template called sidebar:

{embed="embeds/sidebar" the_passed_value="hello"}

Then in the embedded template itself, you could have:

I would like to say {embed:the_passed_value}.

Which would render as:

I would like to say hello.

And so as you see, it is a way to declare a variable within the embed code, passing its value to the embedded template for use there.

1
  • Thanks for the explication, i was not used with embed. – Stéphane Mar 25 '14 at 20:30

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.