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.

User defined global variables + conditionals

November 05, 2008 7:45pm

Subscribe [3]
  • #1 / Nov 05, 2008 7:45pm

    Jamie Pittock

    108 posts

    I’ve defined a global variable called “gv_default_banner” and added an image url.  When I do the following the image url is displayed:

    {gv_default_banner}

    When I wrap it in conditionals nothing is displayed:

    {if gv_default_banner != ""}{gv_default_banner}{/if}

    Do conditionals not work with user defined global variables?

    Note: these variables are defined in Templates > Global Variables, not path.php or in a template.

  • #2 / Nov 06, 2008 1:50am

    Derek Jones

    7561 posts

    User-defined global variables are not run through the template engine, so no.  The conditional you describe is puzzling, though.  Why would you put a variable in your template that you have not defined?

  • #3 / Nov 06, 2008 6:21am

    Jamie Pittock

    108 posts

    OK thanks.  I simplified my example some what.  The code may look like this (still simplifed…

    {if gv_default_banner != ""}<div id="banner">{gv_default_banner}</div>{/if}

    Nevermind, I can work around it now I now I’m not going mad.

  • #4 / Nov 06, 2008 2:59pm

    Sue Crocker

    26054 posts

    smallbeer, sounds like you have a workaround. Please don’t hesitate to post again if needed.

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

ExpressionEngine News!

#eecms, #events, #releases