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.

Embed Template More Than Once

January 25, 2009 10:19pm

Subscribe [2]
  • #1 / Jan 25, 2009 10:19pm

    Matt H.

    32 posts

    Hello,

    For my new website that I’m building with EE, I use a hidden template for the “buttons” that I have in the right hand column of my website. Generally it is just a “Hire Us” button but I’ve made it to use embed variables so it can pretty much display anything I want in the appropriate button format.

    It’s been working perfectly thus far, until I tried to embed the template more than once into another template (a.k.a. I want two buttons on one page). Instead of giving me two unique ones according to the parameters I supply in the embed tag, it just gives me two identical buttons.

    Here is the code in the “button” template to be embedded:

    {if embed:link_title == ""}
    <a href="http://{embed:path}" rel="noopener {embed:rel}" title="{embed:title}" class="nounder" target="{embed:target}">_{if:elseif embed:link_title != ""}_<a href="{embed:path}" rel="{embed:rel}" class="nounder" title="{embed:link_title}"target="{embed:target}">_{/if}_<span class="right_button_wrap">_<span class="right_button">_    <span class="rb_left">_        {embed:icon}_    </span><span class="rb_right">_    <span class="rb_t1">{embed:title}</span>_    <span class="rb_t2">{embed:text}</span>_    </span>_    <span class="rb_clear"></span>_</span></span></a>


    And here is the code that I’m trying to use to embed the template into my pages:

    {embed="site/.right_button" path="{exp:removepar}{preview}{/exp:removepar}" icon="/images/site/icon_globe.png" title="View It" text="Click to see." target="blank"}
    
    {embed="site/.right_button" path="{hire_path}" icon="{hire_icon}" title="{hire_title}" text="{hire_text}"}

    Would anyone be able to point out the problem in my code or a work-a-round to the issue that I’m having. If you’d like a preview you can check out my dev site…

    One Button: http://ee.quickscriptz.ca/about/
    Two Buttons: http://ee.quickscriptz.ca/portfolio/sky-blue-radio/

    Any help would be greatly appreciated - thanks in advance!

    P.S. I think that made sense? Just let me know if I need to clarify…

  • #2 / Jan 26, 2009 1:56pm

    Pascal Kriete

    2589 posts

    Matt,

    The first time I hit the second link it showed up as two different buttons - now I see two of the same.  Are you using any caching on these templates?

  • #3 / Jan 26, 2009 4:15pm

    Matt H.

    32 posts

    Oh, I see what I’ve done…
    I’ve set the “.right_button” template that gets embedded to enable caching - I’ve changed it and all appears to be working now.

    Thanks for your help!

  • #4 / Jan 26, 2009 4:19pm

    Ingmar

    29245 posts

    Glad to see Pascal squared you away there. Please post again anytime you need further assistance.

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

ExpressionEngine News!

#eecms, #events, #releases