0

I am using BrilliantRetail and on my product page, I have tabs with different information about the products. The code for the tabs is pretty long so I would like to make it an include and then embed it within my loop. However, when I do this, the channel fields aren't recognized, is there any way to accomplish this without putting the loop inside the include? Also, please let me know if there is a better way to accomplish my IF statement for the store IDs. Thanks in advance!

{exp:brilliant_retail:product}

        <div class="inner_container">
            <div class="product_detail">
                {if "{store_id}" == "2641" OR "{store_id}" == "2635" OR "{store_id}" == "2572" OR "{store_id}" == "2619" OR "{store_id}" == "2576"}
                    {embed="_includes/tabs"}
                {if:else}
                    {detail}
                {/if}
            </div>
        </div>

{/exp:brilliant_retail:product}
1

Why not to put the code of {embed="_includes/tabs"} into a snippet? In my sample code, I'm calling it snip_tabs.

{exp:brilliant_retail:product}

        <div class="inner_container">
            <div class="product_detail">
                {if "{store_id}" == "2641" OR "{store_id}" == "2635" OR "{store_id}" == "2572" OR "{store_id}" == "2619" OR "{store_id}" == "2576"}
                    {snip_tabs}
                {if:else}
                    {detail}
                {/if}
            </div>
        </div>

{/exp:brilliant_retail:product}

Embeds are completely new templates that are parsed and then inserted into the parent template. You need to insert the code before the parsing. So, snippets are an excellent solution.

To make the edition of snippets easier, you can use the SnippetsSync add on. Just remember to disable the automatic update on your production environment, because this function can make you website really slow. You can do this by setting $config['snippetssync_production_mode_override'] = TRUE; for this environment.

0
0

I'm not 100% sure if this what you trying to accomplish but you can pass parameters through as part of the embed tag. For example:

{embed="site/header" entry_id="2145"}

and then in the template your embedding use the variable like so.

{exp:channel:entries channel="default_site" limit="1" entry_id="{embed:entry_id}"}
    ...
{/exp:channel:entries}

There's more information in ee's docs

http://ellislab.com/expressionengine/user-guide/templates/embedding.html

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.