-
-
Save JonasEriksson/eeef2a20361e3a2fb733930e38f4e54f to your computer and use it in GitHub Desktop.
Mura CMS Video Display Code based on Extended Attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- this code allows for the dynamic listing of any Videos from YouTube or Vimeo added | |
under a Content Item (here,for a company to showcase videos of products or similar) ---> | |
<!--- Pre-requisites: Add a Class Extension of Type Page / Subtype Video with two fields named YoutubeID and VimeoID ---> | |
<!--- Reload App and cfinclude this file or turn below code into a Front-End Item for drag-and-drop use ---> | |
<!--- Note: requires a value for the contentBeanID, below we use the companyName we take from content('Title') ---> | |
<!--- | |
<cfset CompanyName = #$.content('title')#> | |
<!--- load the parent content item - pageTitle: #BetriebName# ---> | |
<cfset contentBean = $.getBean('content').loadBy(title='#BetriebName#')> | |
<cfset contentBeanID = contentBean.get('contentID')> | |
---> | |
<cfoutput> | |
<div class="container"> | |
<!--- Local Content Index Videos of this current contentID ---> | |
<cfset feedBeanVideos = m.getFeed('content') | |
.where() | |
.prop('parentid') | |
.containsValue('#contentBeanID#') | |
.andProp('subtype') | |
.containsValue('Video') | |
.sort('title', 'asc')> | |
<cfset it = feedBeanVideos.getIterator()> | |
<cfif it.hasNext()> | |
<div class="row my-4"> | |
<div class="col-sm-12 section-title heading heading-3 section-title--style-1 mb-2 text-center"> | |
Videos | |
</div> <!--- //col ---> | |
</div> <!--- //row ---> | |
<!--- Loop over the iterator ---> | |
<cfloop condition="it.hasNext()" > | |
<cfset item = it.next()> | |
<div class="row"> | |
<div class="col-sm-12 col-md-9 mb-3 p-2 bg-light "> | |
<div class="embed-responsive embed-responsive-16by9 animate-on-scroll fadeIn"> | |
<cfif Len(item.get('VimeoVideoID'))> | |
<iframe allowfullscreen="" frameborder="0" width="1280" height="720" mozallowfullscreen="" src="https://player.vimeo.com/video/#item.get('VimeoVideoID')#?portrait=0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe> | |
<cfelseif Len(item.get('YoutubeVideoID'))> | |
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/#item.get('YoutubeVideoID')#?rel=0&showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> | |
</cfif> | |
</div><!--- //embed ---> | |
</div> <!--- //col ---> | |
<div class="col-sm-12 col-md-3 mb-3 p-2 bg-light "> | |
<h5>#item.get('title')#</h5> | |
<p>#item.get('summary')#</p> | |
</div> <!--- //col ---> | |
</div> <!--- //row ---> | |
</cfloop> | |
</cfif> | |
</div> <!--- //container ---> | |
</cfoutput> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment