We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27117
    • 28 Posts
    I’m working at a small TV-Station and we are using modx for our corporate website. First of all, I’m still very new to ModX and also my english is not the best, so please forgive me... smiley

    We would like to create a online archive where our visitors can watch, every show that we broadcasted as a video file. My problem is, how to organise all the content in an efficient way.

    Every day, we create about 10 different videofiles. Each videofile has a description file (txt or xml -> we don’t have a solution for that yet but that’s another problem).

    In the ModX Tree, we have already a resource (as container) for every show. Today, we manually update this resource daily with the new text-content. But as I said before, I would like to create an archive solution, where the visitor can see, what was broadcasted e.g. 2 month back. I could now create a new resource in the container on a daily basis and put all nescessary data in manually. But after a short time, there will be hundreds of resources in that container. I can’t imagine, that this is a good solution.

    I need kind of this for a proper solution:
    I have one resource in Modx for every show. All Videofiles are stored in a folder on the webserver (e.g. assets/videos/showname). We have a xml or txt file with the same name as the video file, also stored on the webserver (e.b. assets/text/showname). Now, I need something like getResource, to load the videofile and the text file into the one resource.

    Don’t get me wrong, I don’t want you to present me a complete solution for my problem. I just need a point into the right direction...

    ...and thanks to everyone, who reads the whole thread. It was a bit longer as expected...

    thank you!
      Modx 2.1.3, PHP 5.2
      • 22019
      • 390 Posts
      It sounds like you’ve more or less answered yourself. It sounds like you want ’Show Resource document’ -> AJAX Query?show=foo&date=bar -> XML file -> Output don’t you?

      Unless you meant that each show has it’s own XML file, in which case you might want to do ’Show Resource document’ -> Snippet?show=foo&date=bar (specify which XML file to load)-> individual XML file (with link to end video) -> Output.

      If you want to handle creating / loading the XML aspect as well, I would create a custom table - search the forum for Xdbedit or use the tutorial on the Docs site.

      Yet another option would be to use a front-end resource creator, like Frontpage, or Formit-to-DB, that would allow you to create/update the metadata for each show as a separate resource. How you file it depends on how often you want to use the manager to edit things - you can build your own custom table editor (which bypasses the resource tree), or simply file as year / month / date and pretend it’s a blog (10 resources a day isn’t going to be that hard to work with in the tree).

      I’ve not built anything quite like that myself - so others may have a better handle on this.
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 27117
        • 28 Posts
        thank you very much. I will get trough all your inputs in detail. As I’m very new to modx, sometimes all the functionality is a little bit too much for me smiley
          Modx 2.1.3, PHP 5.2
          • 32070
          • 87 Posts
          A couple of ideas:

          1) You’re probably going to want to look at template variables. Create a template called something like video-viewer. Then create two TVs (both File TVs) - one called videofile the other called videometa.

          You’ll also want to create a snippet or two.

          The first will be to grab the video file and present it in whatever system you’re using to show video (flash, HTML5, etc)

          That will look something like this:

          // Part 1
          $video = $modx->resource->getTVValue('videofile');
          $output .= 'do something with $video';
          
          // Part 2
          $meta = $modx->resource->getTVValue('videometa');
          $output .= 'do something with meta';
          
          return output;
          



          If you’ve not stumbled on it yet, get intimately familiar with this page: http://bobsguides.com/revolution-objects.html

          What you may want to also consider is creating a chunk for each called videoPlayerTpl and videoMetaTpl

          videoMetaTpl could look something like this:

          <h3 class="videotitle>[[+videotitle]]</h3>
          <p class="videodesc">[[+videodescription]]</p>
          


          In your snippet, if you process your xml into an array you can pass that array to a getChunk call and have it fill in the place holders.

          So...

          // Data from XML
          $data['videotitle'] = myFunctionToGetTitle();
          $data['videodescription'] = myFunctionToGetDesc();
          
          $output = $modx->getChunk('videoMetaTpl', $data);
          



          Hopefully this helps. I know it can be a little overwhelming, but it’s more because it’s SO powerful. Once you get the hang of the basic stuff, you’ll be amazed at what you’re capable of with MODX.

          Good luck.






            Des
            webandflowdesign.com
            • 18373 ☆ A M B ☆
            • 3,141 Posts
            I would definitely write a custom component for this.

            In your resource tree, you would create a resource for every show you run using a specific template. That template would in turn have a custom snippet, which will fetch the data from a table. You would create a custom component where you will be able of adding the metadata and link to your video file. (Or upload it through it too, but I expect there to be a somewhat automated solution for that at a TV station).
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 3749
              • 24,544 Posts
              I didn’t notice what version of MODx you’re using. I think I would move to Revolution if you haven’t already (assuming that that’s feasible).

              It’s very simple to pull up and display data from a file named after the current resource, and I think that’s definitely the way to go. I would put the files into a directory structure based on the the calendar so the full path to every file could be generated from its air date. You might want to include part of the date in the file name so the directory structure doesn’t get too deep. Maybe have year and month directories and include the day of the month in the filename.

              You definitely don’t want to end up with a zillion resources down the road.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting