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

    Been playing round with MODX for the last week. Absolutely loving it. I really have to thank Mary from The Coding Pad for doing such great job on her tutorials for us beginners. THANK YOU MARY

    I have a question and I really dont know where to start.

    Brief:

    I have created a TV for the admin user where he/she will be able to select either Yes or No. Here I am using radio buttons.

    The outcome will either be:

    < span class = " yes " > YES < / span >

    or

    < span class = " no " > NO < / span >

    on the website. Just to let you know I have css images applied to these tags. Yes will have a Tick icon and the No will have a Cross icon.

    I really hope this all makes sense.

    So there question is 'How do I do this?'

    Does it involve snippets? To be honest I wouldnt know where to start.
      • 31104
      • 108 Posts
      Hi monkemedia welcome to the forums, TV's are great and fairly easy to use once you get the hang of them, try going through the rtfm and you'll find great explanations on how they work smiley

      There are some good examples as well, where you just might find exactly what you're looking for without needing to do much re-scripting or anything.

      http://rtfm.modx.com/x/LgEdAQ
        • 37633
        • 20 Posts
        upiorz thank you for your reply. I should have mentioned in my previous post that I have been through the wiki tv docs. Unfortunately as I said I dont know where to start. Is there a name for this function? Thanks in advance
          • 31104
          • 108 Posts
          Yeah, it wasn't really the wiki I linked you to, it's the rtfm, I sometimes find it has more detailed info than the wiki.

          Anyways I believe this is what you are looking for?

          http://rtfm.modx.com/display/ADDON/Gallery.Setting+Up+the+GalleryItem+TV

          It won't have the radio buttons, but it will let you choose an image from your gallery and place it wherever you placed the TV placeholder.

          Don't forget to install Gallery via System > Package Management

          Check it out and let us know. smiley

          [ed. note: upiorz last edited this post 14 years, 11 months ago.]
            • 37633
            • 20 Posts
            Hi Upiorz,

            Thanks once again for getting back to me. very much appreciated. Maybe I havent quite explained what I am trying to achieve.

            Hopefully this is better explanation:

            From within the CMS, the user will have an option:

            Does the car have warranty? Yes or NO

            Using Radio buttons for the input and text for the output, The website will appear like:

            Car: Ford
            Color: Red
            Warranty: Yes
            Price: £4,000

            Now instead of having text (Yes/No) next to warranty, how can I replace it with an icon (tick/cross).

            I would ideally like to have it like this (source code):

            <li>Color: Red</li>
            <li>Warranty: <span class="tick">Yes</span></li>

            So I guess I am wondering how do I insert this span tag? Of course the span will change to span class="cross">NO</span> if the admin user selects NO in the radio options.
              • 33968
              • 863 Posts
              Hi there, you can create a TV and set up like this:
              Name:   warranty
              Input type:   radio
              Input options:   Yes==YES||No==NO
              Default value:    Yes==YES      (or NO, up to you)
              

              Assign the TV to the template associated with the resource where the options will be output.

              Then in your html you will do this:
              <li>Color: Red</li> 
              <li>Warranty: <span>[[*warranty]]</span></li>
              


              For more info:
              http://rtfm.modx.com/display/revolution20/Creating+a+Template+Variable
                • 37633
                • 20 Posts
                Thank you Lucas,

                You are a star smiley How could I do it so the output would be either:

                <span class="no" >No</span >


                or

                <span class="Yes">Yes</span>


                [ed. note: monkemedia last edited this post 14 years, 11 months ago.]
                  • 37633
                  • 20 Posts
                  Oooo I solved it

                  Input options:
                  
                  no==<span class="no">No</span>||yes==<span class="Yes">Yes</span