We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37126
    • 37 Posts
    I'm developing a site in 2.2 and it's got real performance issues at the moment. I'm trying to make things more efficient to see if this helps could anyone give me a more efficient way of doing the snippet below which pulls in tv values to be used in a wayfinder call?

    [[!If?
    &subject=`[[+FlagSelector]]`
    &operator=`notempty`
    &operand=`1`
    &then=`[[+showFlag:eq=`1`:then=` [[+FlagSelector]]corner`]]`
    ]]

    Tried this but doesn't seem to work

    $flagselector = $modx->resource->getTVValue('FlagSelector');
    $showflag = $modx->resource->getTVValue('showFlag');

    if ($flagselector !== '' && $showflag == 1) {
    return $flagselector;
    } else {

    } [ed. note: cprookie last edited this post 13 years, 5 months ago.]
      • 38705
      • 101 Posts
      Does

      [[+showFlag:is=`1`:and:+FlagSelector:isnot=``:then=`Your Output`]]
      work for you?
      With the above you check if showFlag=1 + FlagSelector is not empty. If both are true, produce the output..
        Addict since 2012....
        • 37126
        • 37 Posts
        Thanks that works

        [[+showFlag:is=`1`:and:[[+FlagSelector]]:isnot=``:then=`[[+FlagSelector]]`]]

        Quote from: mintnl at Apr 26, 2013, 02:49 PM
        Does

        [[+showFlag:is=`1`:and:+FlagSelector:isnot=``:then=`Your Output`]]
        work for you?
        With the above you check if showFlag=1 + FlagSelector is not empty. If both are true, produce the output..