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

    Here’s my idea, I would like to create a template with a N number of Image TVs.
    I was thinking it would be possible to add that Image TV dynamically, so like a sort of repeater, a button on the template where you can click to add an extra TV to add another Image to the page.
    My goal is to have a template that allows adding as much images as you want.
    Does somebody has done something like that?

    Regards

    Vlax
      • 33992 ☆ A M B ☆
      • 455 Posts
      You know that a new TV will be added to a template TVs and adds a new field in all documents used this template also after adding a TV you should add this new TV tag to template.

      So my idea is using javascript to create any image field, collect all image-field values to a specified TV and put this tag in your template (for this see manager/actions/mutate_content.dynamic.php)

      my another idea is create a richtext editor which has image manager and editor to customize output, put all image you need in it and put TV tag in template.....  undecided
        God loves me. 【ツ】


        MODX.ir (Persian Support)

        Boplo.ir/modx/ (Persian)
        • 30223
        • 1,010 Posts
        What are you after? If you want to have some kind of image gallery you should have a look at MaxiGallery. If not perhaps you could explain what you want to do with the images. This might help us help you smiley
          • 19090
          • 35 Posts
          Quote from: TobyL at Feb 13, 2009, 07:39 AM

          What are you after? If you want to have some kind of image gallery you should have a look at MaxiGallery. If not perhaps you could explain what you want to do with the images. This might help us help you smiley

          Hi Toby
          Thanks for asking.
          What I want to do is to feed a Flash animation with Modx.
          In this Flash Animation I have several sections with project descriptions and each project have a variable number of pictures that belong to that project.
          I’m planing to create a template for the project and I’m going to need to add a variable number of TV (i guess) to then be able to iterate through them and generate the necessary XML.
          I don’t know if I add a MaxiGallery Snippet I would then be able to iterate over the pictures... Perhaps I would give it a go and see if it’s possible.
          But I was thinking I could do something like in DotNetNuke that you can dynamically decide the number of "placeholders" (TV) by adding them on editing mode. I have also experience with TeamSite, and the concept is quite similar, of course at another level. There you can create a "Brick" that admit repetition and then also duplicate the "brick" to add additional similar content. It’s not a very unusual feature in CMS therefore I’m asking how can I accomplish that with Modx smiley

          Thanks in advance

          Vlax
            • 30223
            • 1,010 Posts
            I see what you mean... A TV as it is implemented now would not be the best way to go. Suppose you would be able to add a TV dynamically. In modx TV’s are bound by templates so if you added 10 TV’s to your document any other document using the same template would also have those 10 TV’s (with their own values).

            There is no ready made solution for what you need I’d think. You could determine what the maximum number of images is and simply add that many TVs to the template but that’s not ideal I imagine.

            MaxiGallery could certainly be part of a solution as a script to upload images. You’d then need snippet which reads all the entries for the gallery and outputs your xml. Don’t think MaxiGallery can do that for you but you can check the Maxigallery documentation for that. Again perhaps not ideal.

            The last suggestion I have is to build the functionality yourself (and share it with us smiley ). You could write a plugin which uses the onDocFormPreRender, onDocFormRender and onDocFormSave to add inputs to the document edit form, and save the results in a table.

              • 7231
              • 4,205 Posts
              You can use custom tpl with MaxiGallery to output the XML directly. Create a MODx document for each ’gallery’ and to store the description, then tie it all together with Ditto into a single XML file. I think this will work shocked

              If there are a max number and it is not too high rthen simply create a series of TVs. Only the ones with data get recorded to the db so the unused ones are not overhead (not much at least). Then with PHx you can only display the ones with data.

              The thing with variable number image TV (or variable anything TV) is how to call the TV placeholder for the multiple ones? [*myImage-1*].
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 19090
                • 35 Posts
                Quote from: dev_cw at Feb 13, 2009, 07:01 PM

                The thing with variable number image TV (or variable anything TV) is how to call the TV placeholder for the multiple ones? [*myImage-1*].

                Thanks for your answers dev_cw.
                Very interesting suggestions, I think the first one about using MaxiGallery and Ditto will be the way to go.
                In answer to your question, what I meant for variable number of image TV, was that I want to add dynamically an amount of TVs, that I don’t know beforehand. But you already answered to my question, and your suggestions go in that direction.

                Thanks again for taking time to respond.

                Vlax
                  • 29774
                  • 386 Posts
                  One solution would be to create a managermanager widget to provide a clone button next to the image tv field so allowing multiple images to be entered and dynamically populate the original field (which might be hidden) with comma separated values. The widget would also need to create clones for existing data so the images are editable. In effect you’d have a multiselect image tv type. You could then use a phx snippet to split the string and output each image, eg: [+myimgtv:multipleimages+]
                    Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                    • 19090
                    • 35 Posts
                    Hi All

                    Thanks for all the responses, each one very interesting indeed!
                    I decided to do it another way, a low tech approach  wink
                    I will make each template that needs the variable number of images a container and create another template to store the image + caption + description.
                    Then make create children of the posting with the template that needs the images with the "image-template" and add a snippet that displays all the images on the children nodes in the parent template.
                    Simple but I think effective.
                    There’s just one thing I’m missing to really be satisfied by this approach, is there any way to add new pages from the "quick editor"?
                    It will be nice to have a way to add children pages directly from the quick editor!

                    Regards and I hope this post helps people exploring this kind of problem.

                    Regards

                    Vlax
                      • 19387
                      • 3 Posts
                      i’ve been researching this topic for the past couple of days. this blows as every approach seems counter-intuitive