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.

Embeded Template issue

October 14, 2008 1:10am

Subscribe [2]
  • #1 / Oct 14, 2008 1:10am

    handiyman

    17 posts

    I am trying to achieve a template embeded with child templates. This is what I have done so far.
    a. On the “site” template group on index.php (main template - that serves the home page etc) I have added
    {embed="panel/header"} immediately after the <body> tag.
    b. Created a new template group by name panel and created a template header and I have included logo and all other html.
    When I tried to access my website, that particular embeded portion (header) is not rendered. If I include html (ie header) with in the main templates index.php, the page is rightly rendered. 
    Currently I am working with the header with the index page but prefer to resue it as a embeded template. Can some one guide which way I need to work to make this working.

  • #2 / Oct 14, 2008 2:57am

    Ingmar

    29245 posts

    Can you show us what code you are using to embed the “header” template, or perhaps a link to your site? Also, what version and build of EE are you on?

  • #3 / Oct 14, 2008 6:50am

    handiyman

    17 posts

    The index.php of the main template

    {assign_variable:my_weblog="default_site"}
    {assign_variable:my_template_group="site"}
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
    <html >
    <head>
    <title>{site_name} | {exp:weblog:info weblog="{my_weblog}”}{blog_title}{/exp:weblog:info}</title>
    <meta http-equiv=“Content-Type” content=“text/html; charset={charset}” />

    <link rel=‘stylesheet’ type=‘text/css’ media=‘all’ href=’{stylesheet={my_template_group}/site_css}’ />

    </head>


    <body id=“bd” class=“fs3” >

    <div id=“wrapper1”>
    <div id=“wrapper2”>
    <div id=“wrapper3”>
    <div id=“wrapper4” class=“clearfix”>
    {embed=“related_panels/header"} <!—EMBED COMMAND entered HERE—>

    <!—BEGIN: HEADER—>
    <div id=“headerwrap”>
    <div class=“header-l”>
      <div id=“header” class=“clearfix”>
            <h1 class=“logo”>
            {site_name}</span>
          </h1>
      </div>
      </div>
    </div>
    <!—END: HEADER—>
    </div>
    </div>
    </div>
    </div>

    </body>

    </html>

    The contents of {embed=“related_panels/header"}

    <!—BEGIN: HEADER—>
    <div id=“headerwrap”>
    <div class=“header-l”>
      <div id=“header” class=“clearfix”>
            <h1 class=“logo”>
            {site_name}</span>
          </h1>
      </div>
      </div>
    </div>
    <!—END: HEADER—>

     

    Version : EE 1.6.4 Build:  20080829 (commercial liscence)
    site url: Hindoztan

  • #4 / Oct 14, 2008 10:38am

    Robin Sowell

    13255 posts

    Something looks a bit off.  Your embed should be pulling from the related_panels template group- the header template.  But when I try to access it directly at http://hindoztan.com/index.php/related_panels/header it looks like it fails to come up.  I get a 200, but definitely not the contents above.  Can you access pages other than the main index template?  If you put up a template called ‘test’ and put just ‘Hello world’ on it- nothing else.  Does that display correctly on the frontend?

  • #5 / Oct 14, 2008 5:31pm

    handiyman

    17 posts

    OOPS! It seems like you hit the same time while I was playing around with the templates and groups. Ok Now I am not going to touch it. I will create another group and try mine.
    Yes I have created a “test” template inside the related_panels group. Both http://hindoztan.com/index.php/related_panels/header and http://hindoztan.com/index.php/related_panels/test can be accessed directly from the browser. The header didn;t picup the CSS and that is a different issue. (since we directly access it and the include in the main template I assume it didn;t pickup that)

  • #6 / Oct 14, 2008 8:02pm

    handiyman

    17 posts

    I have removed all the fancy stuffs and trying to embed simple template.

    I have added a new template in the “site” template group called test. The contents of that is

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
    <html >

    <head>
    <title>test</title>
    </head>


    <body>
    This is a pure test page.


    I am adding the embedded test here.
    {embed=“related_panels/test”}
    </body>

    </html>

    The content of {embed=“related_panels/test”}

    hello world!.. I am rendering from inside the embedded template….

    I am getting resultsof both http://www.hindoztan.com/index.php/test and http://www.hindoztan.com/index.php/related_panels/test through browser. But the “site” group’s test templaged is not rendering the embedded template.

  • #7 / Oct 14, 2008 8:26pm

    Greg Aker

    6022 posts

    handiyman:

    Shot in the dark here.  What kind of text editor are you using?  In my testing, I’m reproducing your findings if “curly quotes” are inside the embed tag. 

    Can you peek at your “test” template and make sure the quotes within the embed tag are not curly quotes?  Replace them just to make sure.

    -greg

  • #8 / Oct 14, 2008 9:04pm

    handiyman

    17 posts

    Greg
    Thanks for the lead. It is solved.  I have used the EE default editior (ie editied online in the template edit area). The initial embed command I have cut and copied from the docs area to make it easier for the syntax and there after I was just copying and pasting from the inital one. I thought the EE editor is a text editor (my mistake).
    After your lead, I removed the curly braces checked the result. I got the value rendered as embed=“related_panels/test” . So I removed the command totally and typed a new one manually. Now I got the desired result.
    Thanks onceagain for the lead.. and learnt a lesson today.. don’t cut and paste..

    You can close the case.

  • #9 / Oct 14, 2008 9:09pm

    Greg Aker

    6022 posts

    very cool!  😊

    Make sure to use “simple” text editors when coding your sites, as word processors don’t always play nice.

    I’m glad you are up and running now.  Make sure to post back if you run into anything else!

    -greg

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

ExpressionEngine News!

#eecms, #events, #releases