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.

Unable to use embed tag inside of a {exp:weblog:entries} tag

November 18, 2010 7:04pm

Subscribe [3]
  • #1 / Nov 18, 2010 7:04pm

    sleven1868

    78 posts

    I’m trying to display a different set of product attributes based on a condition. If weblog = something then show these attributes.  So I’m creating seperate templates that display summary information on the products.  I want to do the conditional and then display the summary code thats in the template.

    {exp:weblog:entries weblog="vector|helix|prism|matrix"   style="linear" disable="member_data|trackbacks"}
    {embed="embeds/vector_summary"}
    
    {/exp:weblog:entries}

    Its does not seem to work.  It just displays the contents of the template instead of the value of the tags in the template.

    vetor_summary Template used in the above embed.

    <h2> {title}</h2>
    <p>{product_thumbnail}<br />
    Power Consumption:  {power_consumption}<br />
    Number of LEDs:  {led_num}<br />
    Designed to Replace:  {designed_to_replace}<br />
    {spec_sheets}<br />
    <a href="http://{url_title_path=products/detail}">View Product Details >> </a>

    I cut and pasted the code in place of the embed and it works.  Fixing this helps me display certain product attributes for certain product line.  I can conditionally say, if product line = this then show this embed template to display the product.  Not all products have the same attributes but they have common ones.  So I am using one custom field group for all.  Can someone tell me why this wont work or a better approach?  thanks!

  • #2 / Nov 19, 2010 2:13pm

    Sue Crocker

    26054 posts

    Hi, sleven1868.

    Have you seen: http://ellislab.com/expressionengine/user-guide/templates/embedding_templates.html ?

    This information is for both EE1.x and EE2.x.

  • #3 / Nov 19, 2010 4:57pm

    sleven1868

    78 posts

    Hey Sue,

    According to the link you posted, my code above should work.  But it doesn’t.  Am I missing something?

  • #4 / Nov 20, 2010 3:18pm

    Greg Salt

    3988 posts

    Hi sleven1868,

    Embedded templates are processed and parsed separately so that means that in the example of your vetor_summary template above you would need a weblog:entries tag in order to parse the variables properly. The documentation that Sue linked to shows you how you can pass variables down to embedded templates in order to set the right weblog or entry_id.

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases