Skip to main content Skip to navigation

Step 3: Show extra data for each video

Spinner

Important code

<script type="text/javascript" src="/static_war/api/sitebuilder-0.3alpha.js"></script>

SiteBuilder provides a script to get information about a page as a JS object with functions to change information about the page.

return metadata = Sitebuilder.getPagesByUrls('/',pages);

There are two ways to get information on pages: individual, or for multiple pages (as above) that returns an array of page information. Note that pages are referenced by URL starting at the first forward-slash.

var parentData = Sitebuilder.getPageByUrl(data.parent); 

The single-page version.

var canEdit = (data.canEdit) ? '<a href="http://sitebuilder.warwick.ac.uk/sitebuilder2/edit/page/properties/form.html?page='+data.path+'">Edit properties</a>' : '';

The page object contains the 'canEdit' flag for the user viewing the page.

secondsToTimeText(data.metadata.duration)

For multimedia files the page object contains a 'metadata' object containing the duration, width, height, and url of the automatically generated preview image.