Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Youtube gallery make video embeded...


Go to End


1592 Views

Avatar
raamklaza

Community Member, 182 Posts

29 June 2009 at 12:43am

I downloaded the latest version from the trunk and now the template is in a .ss file (which is good) but now i have lost the ability to embed youtube movies.

I do not want visitors leaving the website.

Below is the old embeded part in YouTubeGallery.php

		$outputHTML = "<ul class='youtubevideos'>";
		foreach($videos as $video){	
			$duration = round((float)$video->content_duration/60, 2);		
			$video->player_url = str_replace("watch?v=","/v/",$video->player_url); 
$outputHTML .= '<object width="425" height="344"><param name="movie" value="'.$video->player_url.'"></param><param name="allowFullScreen" value="true"></param><embed src="'.$video->player_url.'" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object><div class="info"><h6>'.$video->title.'</h6><p>'.$video->description.'<br/><strong>Duration : </strong>'.$duration.'</p></div>';
		}
		$outputHTML .= "</ul>";

The current YoutubeGallery.ss

			<div class="youtubegallery typography">
				
			<% if YoutubeVideos.Count %>
				<ul class="youtubevideos">
				<% control YoutubeVideos %>
					<li>
						<div class="still">
							<% if Top.ShowVideoInPopup %>
								<a 
									params="lightwindow_width={$PlayerWidth},lightwindow_height={$PlayerHeight},lightwindow_loading_animation=false,lightwindow_type=external" 
									href="{$PlayerURL}" 
									class="lightwindow"
								>
									<% control SmallThumbnail %>
										<img src="$URL" alt="$Title" width="$Width" height="$Height" />
									<% end_control %>
								</a>
							<% else %>
								<a href="$PlayerURL" title="$title">
									<% control SmallThumbnail %>
										<img src="$URL" alt="$Title" width="$Width" height="$Height" />
									<% end_control %>
								</a>
							<% end_if %>
						</div>
						<div class="info">
							<h6>
								<% if Top.ShowVideoInPopup %>
									<a 
										params="lightwindow_width={$PlayerWidth},lightwindow_height={$PlayerHeight},lightwindow_loading_animation=false,lightwindow_type=external" 
										href="{$PlayerURL}" 
										class="lightwindow"
									>
										$Title
									</a>
								<% else %>
									<a href="$PlayerURL" title="$Title">$Title</a>
								<% end_if %>
							</h6>
							<p>
								$Description<br />
								<strong>Duration : </strong>$Runtime
							</p>
						</div>
						<div class="clearfix"></div>
					</li>
				<% end_control %>
				</ul>
				
				<div class="pages">
					<div class="paginator">
					</div>
					<span class="results">($YoutubeVideos.Count Videos)</span>
				</div>
			<% else %>
				<span>Sorry! Gallery doesn't contain any images for this page.</span>
			<% end_if %>
			
			</div>

Can some help me out putting the .php part into the .ss part???