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.

embeds don't seem to work

September 10, 2008 6:32am

Subscribe [2]
  • #1 / Sep 10, 2008 6:32am

    joninnz

    6 posts

    if I just seperate my content into header and footer and embed those as {embed="templateGroup/header"}, the final webpage loses styles, title, and anything else that relies on weblogs or variables even if I pass the variables in the embed tag. This is not quite what I expected. It seems all you can do with the embed command is add little snippets of HTML or am I missing something.

  • #2 / Sep 10, 2008 6:39am

    kriz

    231 posts

    Not really. I think it should work.

    It may be that you are not defining the paths correctly. Can we see how your header looks like?

  • #3 / Sep 10, 2008 6:54am

    joninnz

    6 posts

    Header—————————-

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>{exp:weblog:info weblog="{my_weblog}"}{blog_title}{/exp:weblog:info}</title>
    <link rel='stylesheet' type='text/css' media='all' href='{stylesheet={this_template_group}/site_css}' />
    </head>
    <body class="home">
    <div id="header">
      <h1 id="logo">Avocado Food and Wine Festival</h1>
      <div id="menu">
        <ul>
          <li><a href="http://{path={this_template_group}/index}">Home</a></li>
          <li><a href="http://{path={this_template_group}/wineries}">Wineries</a></li>
          <li><a href="http://{path={this_template_group}/entertainment}">Entertainment</a></li>
          <li><a href="http://{path={this_template_group}/about}">About</a></li>
          <li><a href="http://{path={this_template_group}/contact}">Contact</a></li>
        </ul>
        <div class="clear"></div>
      </div>
    </div>
    <div id="tray">
      <div id="eventdetail">
      {exp:weblog:entries weblog="Homepage" limit="1"}
        {Date_and_Time}
        {Location}
        <a href="http://{Google_location}">Show me on a map</a> </div>
      {/exp:weblog:entries}  
      <div id="prices">
        <ul>
      {exp:weblog:entries weblog="tickets" limit="1"}
        {exp:simple_commerce:purchase entry_id="{entry_id}" success="{this_template_group}/success" cancel="{this_template_group}/index"}
          <li>Admission:</li>
          <li class="admission">${exp:number_format number='{item_regular_price}'}</li>
          <li>Early bird:</li>
          <li class="admission"><a class="earlybird">${exp:number_format number='{item_sale_price}'}</a></li>
        {/exp:simple_commerce:purchase}
      {/exp:weblog:entries}
        </ul>
      </div>
      <div id="sunrise">
      {exp:weblog:entries weblog="pages" entry="{this_messageID}" limit="1"}
        <h2>{Sunrise_Message}</h2>
    <p>  {/exp:weblog:entries}<br />
        <ul id="conditions"><br />
      {exp:weblog:entries weblog="tickets" limit="1"}<br />
          {Conditions}<br />
      {/exp:weblog:entries}<br />
        </ul><br />
      </div><br />
      <div class="clear"></div><br />
    </div><br />
    <div class="clear"></div>

    Template with embed tag in it—————————————-

    {embed="avofest/header" this_template_group="avofest" this_messageID="4"}
    
    <div id="sections">
      <div class="inner">
      {exp:weblog:entries weblog="pages" entry_id="{this_messageID}"}
        <h2>{content}</h2>
    <p>  {/exp:weblog:entries}<br />
        <br />
        <br />
        <br />
      </div><br />
    </div></p>
    
    <p>{embed="avofest/footer"}

    ——————————-

    at the moment the page renders with none of the embedded templates rendered properly

    I was hoping it would be much simpler

  • #4 / Sep 10, 2008 6:57am

    kriz

    231 posts

    Not rendered properly, as in the style sheets are not being applied or are some of the embedded pages not being displayed at all?

  • #5 / Sep 10, 2008 7:05am

    joninnz

    6 posts

    http://www.avofest.co.nz/index.php?/avofest/

    check out the result and roll over the links in the main menu - the embedded template seems to be rendered literally with {tags} as plain text. Saying that the weblog tags are working in the header - it’s just the variables that don’t get passed to the embedded template.

  • #6 / Sep 10, 2008 7:23am

    kriz

    231 posts

    By the way your style sheets are not being applied (at least, from my side)

    And I cannot see where the variable {this_template_group} is being assigned in the source code you provided earlier.

    Additionally, you can also try putting: href=”{homepage}/wineries”

  • #7 / Sep 10, 2008 10:35am

    Robin Sowell

    13255 posts

    kriz nailed it- you haven’t defined {this_template_group} so your links are looking like

    href='http://www.avofest.co.nz/index.php?css={this_template_group/site_css}' >

    Keep in mind, a dynamic global applies only to the template it’s on.  So you’ll need to define those variables at the top of each embedded template as well.  The only way to have a variable ‘pass’ to an embedded template is via the use of embed variables.

    That all make sense?  Basically- define you’re variables at the top of the included templates and you should be good to go.

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

ExpressionEngine News!

#eecms, #events, #releases