Question

I'm currently building a site that allows previewing photos and videos using Shadowbox. I'm also using the jQuery Tools Scrollable tool to allows the thumbnails to be scrolled. I'm using ModX as the CMS.

I want whoever edits the page to be able to use TinyMCE as the editor, this has been OK for the photos but for the videos I want a description for each video too. I need the code to be in the following format as each of the elements for a video need to be wrapped in a div for the scrollable to work properly.

<div>
   <a href="video_preview/stupid girl.flv"><img src="images/vid.gif" alt="video 1" title="Stupid Girl" /></a>
   <h4>STUPID GIRL</h4>
   <p>Garbage perform classic hit Stupid Girl</p>
</div>
<div>
   <a href="video_preview/rehearsals.flv"><img src="images/rehearsals.jpg" alt="video 2" title="Rehearsals" /></a>
   <h4>REHEARSALS</h4>
   <p>Garbage back stage and at rehearsals</p>
</div>

Here there are 2 videos put I want to allow any number of videos to be entered. At the moment I can't get TinyMCE to generate code in this format. How do I go about doing this or is there a different way I should be looking at this. At the moment the above code section is contained within it's own Chunk

Was it helpful?

Solution

I think you are going about this in the wrong manner.

Create a new folder called Videos The documents in Videos don't need to show in menu etc. Assign the documents in Videos a template in this case "videos-template"

Create template variables for that template for the following items: Movie-file, title, description.

Use the HTML you have there in a chunk, in this case "video-chunk" ie.

    <div>
   <a href="[*Movie-file*]"><img src="images/vid.gif" alt="video 1" title="Stupid Girl" /></a>
   <h4>[*title*]</h4>
   <p>[*description*]</p>
</div>

Then in a chunk use Ditto to interate through your "videos" folder with the above chunk as the template ie.

[!Ditto? &parents=`183`&orderBy=`createdon ASC` &display=`5`
  &total=`5` &tpl=`video-chunk`!]

Let me know if that makes sense but in my mind you should certainly be tackling it in a manner similar to this.

This way when the user wants to add new videos they simply create a new document in the videos folder and set the template variables.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top