A customer contacted us and asked how she could embed a Windows Media file into 20/20 DataShed's pages. Here are the details:
20/20 DataShed already provides an "upload" utility which enables you to upload photos or documents (such as videos). So that part is easy -- this customer can upload a movie file for each of her listings.
20/20 DataShed already provides a method to display links to download the documents that are associated with listings. So that part was also easy -- visitors would be able to click and view the movie files.
The only part that wasn't already available was a method to actually play the movie file in an "embedded" media player like below. (This customer wanted the Windows Media Player to appear directly in the web page rather than pop open in a new application.)
We determined that this was possible using 20/20 DataShed's tools and would not require any modification to the product's source code. With a simple edit to the "item_template(Default).html" file (which is a basic HTML document), we could accomplish this customer's request.
We knew these things before attempting this project:
First, we uploaded a sample movie file (here) to one of her listings.
Next, we modified the "item_template(Default).html" file like this:
[MultiPhotoModule::img.width{300}:img.aspectratio{3/4}:value]
That token produces the "MultiPhotoModule". However, this customer explained that she'd prefer the movie appear in that location on the page instead. So...
[DocumentModule::index{1}:separator{}<object id="MediaPlayer" width="320" height="286" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"><param name="filename" value=":URL" /><param name="Showcontrols" value="true" /><param name="autoStart" value="true" /><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="MediaPlayer" showstatusbar="true" enablecontextmenu="false" autostart="true" loop="false" width="320" height="286" src=":URL"></embed></object>]
The important aspects of this token is the careful use of the ":index{}" attribute and the ":URL" property. In effect, this token peforms the following logic:
Note: The "index{}" attribute and ":URL" property are supported in the [DocumentModule:] token since 20/20 DataShed version 1.0.22.
Also note that the token will exit if there are no documents available for the item and nothing will be written to the page.
[DocumentModule:<h6 style="margin-top:12px;">:label</h6>:value:separator{<br />}]
This token will produce hyperlinks for the entire list of available documents. The result is similar to this:
Downloads
Hello World (Movie)
Software!