We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42428
    • 6 Posts
    Hi all,

    I've just created my first MODX site, and the experience has been wonderful. I'm very pleased with it thus far.

    One issue I have encountered is that I cannot set a default value for an image TV, nor can I set the image TV back to default once I've selected an image.

    In this particular case, my primary template has a header image. Some pages may have header images, some may not, and some may have 'seasonal' header images - so I need the ability to remove the image from a page. The CSS for the page handles the presence or absence of the header image gracefully, so I'm not looking for anything fancy.

    Ideally, I'd like to have the image returned if an image is selected, or no value at all returned if no image / default is selected.

    Thanks!
    - Chris

    This question has been answered by sottwell. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can leave the default empty, and simply delete the path in the TV for any resource to empty it. If you use the "image" output widget for the TV it won't return anything if the TV value is empty, while it will return the <img...> tags if there is an image selected.

      http://rtfm.modx.com/display/revolution20/Image+TV+Output+Type

      You can also use MODx tags, such as the [[*longtitle]], for the image tag attributes such as alt or title.

      Another way to handle TV output is to use output modifiers

      http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29 [ed. note: sottwell last edited this post 13 years, 9 months ago.]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 42428
        • 6 Posts
        Quote from: sottwell at Dec 29, 2012, 06:18 AM
        You can leave the default empty, and simply delete the path in the TV for any resource to empty it. If you use the "image" output widget for the TV it won't return anything if the TV value is empty, while it will return the <img...> tags if there is an image selected.

        http://rtfm.modx.com/display/revolution20/Image+TV+Output+Type

        You can also use MODx tags, such as the [[*longtitle]], for the image tag attributes such as alt or title.

        Another way to handle TV output is to use output modifiers

        http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29</img...>

        Hi Susan! First off, thanks for all your detailed posts on this forum, I've learned a lot from you and some of the other active users.

        Second off, I had no idea that the image drop down was also a text box! Deleting the path definitely solved my problem.

        Thanks so much!

        - Chris
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Yes, there are a number of features in the Manager that are obscure due to the styling or a lack of UI indicators of the possibilities. That field does not look like what we expect an input field to look like, so unless you're inclined to randomly click on things and mouse-drag thing you'd never guess. A lot of things can be accomplished with a right-click or a double-click with no indication of the feature, so it's useful to just play with the interface to see what it will do.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org