We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16867
    • 10 Posts
    After updating to version 1.8.1 (and I’m having the same problem with 1.8.2b), I noticed that the ’ifempty’ phx function stopped working in result item templates (&tplAjaxResult and &tplResult). It worked fine in the 1.7.x versions.

    Here was the relevant part of my &tplAjaxResult and &tplResult template (ifempty call in line 2):

    <div class="ajaxSearch_result">
      <a class="ajaxSearch_resultlink" href="[+as.resultLink+]" title="[+as.description+]">[+as.longtitle:ifempty=`[+as.pagetitle+]`+]</a>
    </div>


    After going to 1.8.1, this would only output the value of [+as.longtitle+] and not parse the ifempty parameter if the as.longtitle were blank.

    I hacked together a fix with a different PHx function by going about it a different way:
    [+phx:if=`[+as.longtitle:len+]`:is=``:then=`[+as.pagetitle+]`:else=`[+as.longtitle+]`+]


    That worked fine.

    So, I guess this is FYI since I figured out a solution, but does anyone have any thoughts as to why ifempty would have stopped working?

    I’m using:
    ModX 0.9.6.3
    AjaxSearch 1.8.1 or 1.8.2b (was able to recreate in a few environments)
    PHP 5.2.5
    MySQL 5.0.67

    Happy to help if you need more information.

    Cheers!