ContentBuilder provides a plugin for displaying self-hosted videos and YouTube, Vimeo and Dailymotion. The plugin can be obtained from here:
crosstec.org/solutions/contentbuilder.html
You'll find usage instructions in the plugin's details from within the plugin manager.
====================
Below there is an example how to embed videos without using the plugin. For example if you like to add a video community that is not supported. The example is for Youtube but the same principle will work for most video communities out there
====================
Let's say you created a data storage that provides a field to enter a youtube url and want to display an embeded video in the resulting article - with a simple setup you will be able to do so.
- Create your data storage with a field named "youtube" for the youtube url and publish it
- Create a view on that data storage item
- In that view, add this to the Content Template (you might want to turn off tinymce/jce as it will probably strip the iframe tag!)
<iframe src="http://www.youtube.com/embed/{youtube:value}" width="300" height="200" frameborder="0" allowfullscreen title="{youtube:label}"></iframe>
- In the Content Prepare tab, add this to strip the id from the url
$url = explode('?',$items["youtube"]["value"]);
$url = $url[1];
parse_str($url, $youtube);
$items["youtube"]["value"] = isset($youtube['v']) ? $youtube['v'] : '';
- Create an editable template
- In the settings of the text "youtube" text field add this in the "Scripts" tab under "Validation Code" (built-in form builder, NOT breezingforms):
$exploded = explode('?', $value);
if(count($exploded) != 2) {
$msg = 'Invalid YouTube link!';
}
else {
parse_str($exploded[1], $out);
if(!isset($out['v']) || (isset($out['v']) && trim($out['v']) == '') ){
$msg = 'Invalid YouTube link!';
}
}
- Save the view and copy a youtube url into your youtube field when adding a new entry and you should see the video in the details/article
We are currently developing a video plugin with more features, but for now embed videos like described above. The procedure will be similiar for other video communitues, as well.
Regards,
Markus