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

    i need to put multiple items to a page.
    For example, i have to add multiple Images or multiple Download Items.

    So, if i define an additional Image to a page (via template variable), i want a button
    "add another Image" beside the input field for the Image. (or something similar)

    Is this possible or is there a snippet to do that? Maybe in combination with lightbox.js?

    This doesnt seem to be an exotic feature for an CMS. Does anybody have an an idea?


    greets + thanks,
    Ecki
      • 25663 MODX Staff
      • 12,272 Posts
      There aren’t input TVs like you’re talking about in MODx.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 23948
        • 15 Posts
        Hi,

        Quote from: rthrash at May 29, 2006, 07:46 AM

        There aren’t input TVs like you’re talking about in MODx.


        Oh Noez!

        I had to bump this thread because it is exactly what I am looking for as well - a way to have n entries for a given template variable in a document.

        This would be extremely useful for correlating unspecified numbers of files,images, et cetera with a given document.

        Is there any workaround or alternate approach? This is a huge roadblock in a otherwise smooth site deployment with modx!!!

        Thanks!
          • 30223
          • 1,010 Posts
          A huge roadblock for what? For the uptake of MODx? I doubt it. For you using MODx? I hope not.

          Yes I agree that adding multiple files via one TV could be very handy but there’s no ready made solution in MODx for what you’re looking for at this time, but dig deep into MODx and perhaps you’ll come up with one. If you do share it with us, the other users of MODx.

          AS far as Ecki’s question is concerned. If it’s something like an image gallery you’re after a have a look in the repository. There’s one or two there. If it’s just adding a few images to a page you can always use the Rich Text Editor to add images (or any other file for that matter). And if you must use a TV you can always try to set the TV to use the rich text editor.
            • 27226
            • 186 Posts
            The best way I can think of to accomplish this would be a TV containing a @select binding. This, of course, requires that you store the stuff of n-appearances in a seperate table, and, if images or other non-text items are involved, provide a type of rendering which can be returned by the binding (as a href for instance).
            I think its absolutely doable without too much work!
            BTW: the TVs are indeed something that should be changed from the ground up. They are by far too inflexible, structure-wise, as your use-case clearly demonstrates.
              • 23948
              • 15 Posts
              Thanks for the replies guys.

              This is not about being able to add images to templates, there are indeed plenty of solutions for that.

              And @SELECT binding are clearly a good and feasible way of rendering data that has already been entered.

              Its data entry that’s problematic.

              What I am attempting to address here is the need for my clients to edit DB records with n entries in the manager, while they edit the documents that this data needs to be correlated with.

              That, to me, seems the strength of TVs, they are automagically associated with a document and editable with said document.

              Example: I have events templates. Aside from a normal rich-text article, I also need to store:


              • n artist names (some shows have 10 artists, some have just 1)
              • n dates
              • n mp3 tracks for an embedded player

              I am still holding out hope that there is some way to enter this data in the manager directly. I can create client screens for these task, or indeed a whole standalone admin application....but OH MAN the TV system is so close to being a much quicker solution.

              Anyone else have any approaches to this issue? Mods? Project team? Thanks!
                • 27226
                • 186 Posts
                I guess this is possible, but needs some manual work. Obviously you can’t use @select for doing updates or inserts, so you’ll have to create a form for data entry for your individual table(s), and it is this form which could then be integrated to the site using a TV or Chunk (if it’s the same form on all pages, this should be easier than using a TV), containing the form, most likely together with a snippet called in the TV/Chunk to do the actual db-processing and parsing of form-data.
                I.e. you will probably not have a 1:1 relation between TV and field or TV and item.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I’m working on an AJAX editable data grid widget. Javascript is not my strong suit, so it’s going to take a while.

                  That will be quite MODx-buzzword compliant; TV, widget, AJAX... what else can I throw in there? grin
                    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
                    • 23948
                    • 15 Posts
                    howdy my good people.

                    so, my solution was use textboxes for the TVs that require n values. In the comment for the TV, I instructed the client to use one value per line.

                    And then, in a snippet, just explode() by a newline character to seperate the values.

                    works like a charm for the time being.

                    cheers then.