Question

I have a Google fusion table that contains a youtube iframe. When I edit the info window to something like this:

<div class='googft-info-window'  style='width:180px;height:100%;'>
<b>{Title}</b><br><br>
<div class='video-container'>{Youtube}<br>
<img src="{Photo}" width="180" /><br>
<a href='{Link}' target='_blank'>{Link}</a><br>
</div>
</div>

It displays correctly, with the youtube iframe displaying the video.

I want to use dynamic templating so that I can say something like, if the photo exists output it, if not output nothing.

I tried:

{template .contents}
<div class='googft-info-window'  style='width:180px;height:100%;'>
<b>{$data.value.Title}</b><br><br>
<div class='video-container'>
<br>{$data.formatted.Youtube}<br>
<img src="{$data.value.Photo}" width="180" /><br>
<a href='{$data.value.Link}' target='_blank'>{$data.value.Link}</a><br>
</div>
</div>
{/template}

but I can't get the iframe to generate as a youtube video, instead it comes out as plain text. I can't find any information on how to display the video using the dynamic templating. Any ideas?

Était-ce utile?

La solution

I found the answer. I changed the variable from

{$data.formatted.Youtube} 

to

{$data.formatted['Youtube'] |noAutoescape} 

noAutoescape prevents the output from being HTML-escaped. I found this information from https://developers.google.com/closure/templates/docs/functions_and_directives?hl=ru#print_directives

The youtube iframe now displays correctly.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top