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

    I would like to put a template variable that works like the Image TV (that you have an "Insert" button and then you see a file manager and selects the flash file you want to use).
    I tried doing it with the Image type TV, but first of all it didn’t allow me to upload swf files (although I added the swf extension to the System Configuration section), and second of all it didn’t showed any swf files (that I uploaded in another way).

    So how can I resolve this matter?

    Thanks A Lot!
    • I needed something similar, where I could not use the image TV. So I created a chunk with the full <img... tag for the images, using a TV for the actual filename of the image. Then all I had to do was to insert the filename of the image in the TV for each document, and upload my images to the folder in the path in the chunk. Not quite as handy, but pretty easy to maintain, especially if you take a little care in naming your .swf files in this case.
        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
        • 4369
        • 31 Posts
        I’ve lost you there.. smiley
        • Make a chunk, "EmbedFlash":
          <object ... blah blah... (sorry, I'm not a flash person)
          file="[*flashfilename*]" ...
          ....
          path="assets/flash/[*flashfilename*]" ...
          </object>
          


          Make a TV named "flashfilename", give it a nice title, "Flash Filename" and description, "set filename for embedded flash object", maybe put a default filename in the Default value field if you have such a flash file, "default.swf", or leave it empty. Make sure your templates that will need this TV have access by checking the checkbox for them at the bottom.

          Now, for each document using that template, use the chunk where you want the flash to appear: {{EmbedFlash}}. Edit the "Flash Filename" TV field under the document content field. Just put the name of the flash file, such as "flashlogo.swf".

          The chunk already has all the rest of the information needed to embed the flash file. It will be given the value you put as the filename in the TV for that document, and you’re all set.
            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
            • 4369
            • 31 Posts
            Oh, gotcha about that.
            Unfortunately, I need my client to select it visually and not entering the file name. He is not a technical person.
            So I need it to be like the image insertion.
              • 15987
              • 786 Posts
              buzi,
              Do you know what the names of the flash files will be and where they will be stored. If so you could use a listbox or drop down list tvar and give your client choices to select from. That way they would have a nice list of choices and you could have it store the filename.
                • 10472
                • 22 Posts
                buzi,

                Did you ever arrive at a satisfactory work around?
                  • 10472
                  • 22 Posts
                  If you’re interested, I managed to fashion a workaround using an @EVAL statement to populate a listbox with all files from a specified directory. It works pretty well:

                  @EVAL $handler = opendir(’../assets/flash/webdemos/’);$delim=’’;$counter=0;while ($file = readdir($handler)){if($counter<>0){$delim=’||’;}if ($file != ’.’ && $file != ’..’) {$results .= $delim.$file;$counter++;}}closedir($handler); return $results;

                  You will need to change the opendir statement as required.
                  • garethf,

                    Would that allow you to choose from a series of short flash animations and string them together in a hopefully somewhat seamless manner?
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 10472
                      • 22 Posts
                      Ryan,

                      I guess it could do - it depends on what you did with the varaiables. I guess you use a multi-select list box to return (an array of ?) multiple values. Some clever snippet or actionscript could then string them together.

                      Gareth.