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.

Simple If Statements with Customer Globals?

December 01, 2010 6:57pm

Subscribe [8]
  • #16 / Jan 20, 2011 10:50pm

    Eric Snyder

    202 posts

    Sorry…I just realized tis thread is in Legacy support not 2.0 support. All my info is for Version 2.1.3 Build 20101220

  • #17 / Jan 21, 2011 10:32am

    Ingmar

    29245 posts

    You mean you’re putting the whole tag in your global variable? Variables are meant to hold data, not EE tags. They won’t be executed there; you’d have to use snippets or embedded templates instead.

  • #18 / Jan 21, 2011 10:56am

    Eric Snyder

    202 posts

    Remember that this is in EE 2.1. Please see my post here.

    The code:

    {if phone_800_number}
    
    {phone_800_number}
    
    {/if}

    phone_800_number is a global variable and the value of the global variable is “800-888-8888” without the quotes. If is use the code above the “800-888-8888” does not output. If I use:

    {phone_800_number}

    alone without the conditional the “800-888-8888” does output.

    The global variable works if it is not used as a conditional. If it is used as a conditional the conditional does not output.

    I also tried putting text (“test” without the quotes)in for the value of the global variable but that did not resolve the issue. I also tried:

    {if phone_800_number}
    
    {phone_800_number}
    
    {/if}

    and

    {if phone_800_number != ""}
    
    {phone_800_number}
    
    {/if}

    and

    {if phone_800_number <> ""}
    
    {phone_800_number}
    
    {/if}

    and none of those worked. They either don’t output the value of the global variable or cause EE to stop parsing and return a blank page.

  • #19 / Jan 21, 2011 5:33pm

    Sue Crocker

    26054 posts

    Hi, Eric.

    Global variables are strictly text replacements. You’ll need to use a snippet for this. (Also responded to an earlier thread.)

  • #20 / Jan 21, 2011 10:42pm

    Eric Snyder

    202 posts

    Low Variables is the answer to this. It is a solution that costs cash but seems to work for these needs. It allows one to keep a blank variable in the list and allows the use of the variable in a conditional. You do need to enable the variable for early parsing to use as a conditional.

  • #21 / Jan 23, 2011 4:50pm

    Greg Salt

    3988 posts

    Hi Eric,

    Okay, glad that you got this sorted out.

    @rjfranco and GlobalGraphics, how are you both getting on?

    Cheers

    Greg

  • #22 / Jan 26, 2011 10:00am

    GlobalGraphics

    36 posts

    I have given up and used something else.

    Thanks anyways. 😊

  • #23 / Jan 26, 2011 5:51pm

    Ingmar

    29245 posts

    Very good. Closing this thread, please don’t hesitate to post again in case there’s anything else.

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

ExpressionEngine News!

#eecms, #events, #releases