Jump to content

Youtube Template Tag


sobrenome

Recommended Posts

Posted

Is there a template tag available on Pages to parse Youtube URLs to get advantage of responsive layout display?

​.

I didn't see any YouTube tag yet .. I think it's just the normal iFrame / CSS routine ..

 

.

Posted

I am creating a custom database which one of the fields will be to record the related youtube url for the content.

So I have to make a custom record display template to show the youtube video embended. I dont want to use the ckeditor for that. 

Posted

I am creating a custom database which one of the fields will be to record the related youtube url for the content.

So I have to make a custom record display template to show the youtube video embended. I dont want to use the ckeditor for that. 

​.

You will need the "template key" or also named "field key" to be set and then you can use that kind of tag in your "listing" or "display" template ..

use it this way ..

{$record->customFieldDisplayByKey('YouTube', 'display')|raw}

 

 

2015-05-19_8-02-33.thumb.png.525b2847ac6

 

 

.

 

Posted

Yes, that's right.

But what I want is a template tag to parse the youtube url to generate the responsive html output for youtube video.

​.

I think what you want just happens automatically if you fit all the pieces together ..

You make a YouTube field > you add a record > fill in the YouTube URL > save .. display the record > YouTube is responsive on its own, it will show the video embedded ..

You creating a custom template > use the field key .. test your template .. Your YouTube should be responsive ..

..

 

.

Posted

Yes, that's right.

But what I want is a template tag to parse the youtube url to generate the responsive html output for youtube video.

​Just add the 100% width as option to the YouTube field and make sure you output the field on its own line so it doesn’t share the space with other elements on that line. 

Posted

I just tried it. Added a YouTube field, added the 100% width parameter in the field options. 

Screen_Shot_2015-05-20_at_07.53.02.thumb

Made sure the field is set to show the player:

Screen_Shot_2015-05-20_at_07.49.35.thumb

And I instantly get the responsive videos in the record view. 
If you change that last option to Plain URL you can of course put your embed code directly in the template. But I don’t think you have to. 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...