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.

How to Evaluate Between Global Variables and Parameters in Templates

January 29, 2010 3:17pm

Subscribe [2]
  • #1 / Jan 29, 2010 3:17pm

    Chris Wetterman

    16 posts

    I have a template where I am passing in a parameter to determine which HTML header to display and am using a global variable to compare against. The {if} block below never evaluates, but when I output the values directly to the page they equal each other. Could someone point out where I might be going wrong?

    site/index

    {!-- Pass in the name of the template containing meta data. Do not include the group template name here. Must reside in the snippets template group. --}
    {embed="embeds/header" meta="{global_meta_main}"}

    embeds/header

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html >
    <head>
    <title>Site Title</title>
    
    {!-- include page specific metadata --}
    {embed="snippets/{embed:meta}"}
    
    </head>
    <body>
    
    {!-- We have 2 different headers; one for the main page and one for everyone else --}
    {if "{embed:meta}" == "{global_meta_main}"}
        {embed="embeds/navigation"}
    {if:else}
        {embed="embeds/navigation_with_banner"}
    {/if}

     

    If seem to be running into the same issues as in this post. To note, I’m not querying any entries at this point. This is just for meta tags and header and navigation.

    http://ellislab.com/forums/viewthread/137191/

    Thanks.
    Chris

  • #2 / Jan 29, 2010 3:35pm

    Gareth Davies

    491 posts

    I think it’s to do with the fact that Global Variables are parsed very late on hence are not being evaluated correctly.

    Have you seen Fresh Variables or Low variables (the last one being commercial)

    http://expressionengine.com/downloads/details/fresh_variables/

    http://loweblog.com/software/low-variables/

  • #3 / Jan 29, 2010 4:58pm

    Chris Wetterman

    16 posts

    Thanks, Gareth. That was it.

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

ExpressionEngine News!

#eecms, #events, #releases