Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • Revolution
  • Revo Release Support
  • Revolution 2.0
  •  
  • notempty filter not working with placeholder#

  • 14883
    315

    jrotering Reply #1, 1 year, 8 months ago

    Reply
    • Link to this post#1
    This must have something to do with the parse order or something.
    [[!setPlaceholders]] // $modx->setPlaceholder('siteCssOverride', '/path/to/override.css');
    [[+siteCssOverride:default=`<link rel="stylesheet" href="[[+siteCssOverride]]" />`]] // this works, outputs <link> element
    [[+siteCssOverride:notempty=`<link rel="stylesheet" href="[[+siteCssOverride]]" />`]]//this doesn't work; no ouput
    


    :notempty seems to work fine for TVs and other elements, but not for placeholders. Is the placeholder value somehow empty at the time the filter is applied? Very confusing.



  • 14883
    315

    jrotering Reply #2, 1 year, 8 months ago

    Reply
    • Link to this post#2
    This works as a workaround to do what I want (show nothing if empty, show the value inside a <link> element if not empty):
    [[+siteCssOverride:if=`[[+siteCssOverride]]`:eq=``:then=``:else=`<link rel="stylesheet" href="/[[+siteCssOverride]]" />`]]



  • 18373
    1,869
    Mark Hamstra
    Senior Developer, MODX Complete Team
    MODX, LLC

    Email: support@modx.com
    Twitter: @mark_hamstra
    Web: modx.com | Twitter: @modxcms | Facebook: modxcms, MODX.Nederland

    Also visit my Github profile, personal website and MODX Blog for more MODX goodness.

    Mark Hamstra - MODX Complete Team Reply #3, 1 year, 3 months ago

    Reply
    • Link to this post#3
    Running into the same problem in 2.0.7... while the workaround is a possibility, I'm also wondering why this wont work on placeholders...


    A similar (but slightly cleaner imo) workaround could be
    [[!+fi.error.email:isnot=``:then=`<br />[[!+fi.error.email]]`]]


  • 28215
    4,064
    - MODX Senior Developer
    shaun mccormick | modx foundation | modx revolution | bugtracker | official docs | modx@github | api docs | splittingred.com

    splittingred Reply #4, 1 year, 3 months ago

    Reply
    • Link to this post#4
    You should make those placeholders uncached.


  • 18373
    1,869
    Mark Hamstra
    Senior Developer, MODX Complete Team
    MODX, LLC

    Email: support@modx.com
    Twitter: @mark_hamstra
    Web: modx.com | Twitter: @modxcms | Facebook: modxcms, MODX.Nederland

    Also visit my Github profile, personal website and MODX Blog for more MODX goodness.

    Mark Hamstra - MODX Complete Team Reply #5, 1 year, 3 months ago

    Reply
    • Link to this post#5
    I can't talk for James, but it aint working for me uncached either...


  • 28215
    4,064
    - MODX Senior Developer
    shaun mccormick | modx foundation | modx revolution | bugtracker | official docs | modx@github | api docs | splittingred.com

    splittingred Reply #6, 1 year, 3 months ago

    Reply
    • Link to this post#6
    [[!+fi.error.email:notempty=`<br />[[!+fi.error.email]]`]]


    Should work fine. I've tested that on multiple environments.


  • 38297
    2

    mikem.uk Reply #7, 4 months, 1 week ago

    Reply
    • Link to this post#7
    I was struggling to get this working. Seems to be important to put the snippet call that sets the placeholder in the code before :notempty.





Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
jrotering, markh, mikem.uk, splittingred

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Careers at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy