Embedding Youtube Videos - what class attribute?

Author Message

Matthew Knight

Monday 27 October 2008 9:24:23 am

I'm relatively new to EZ, and still getting my head around the platform, so I'm probably being absolutely stupid - but what class attribute would you use if you wanted to allow CMS editors to copy and paste in embed tags, such as youtube videos?

Andrew Duck

Monday 27 October 2008 12:15:16 pm

Hi Matthew,

Well you could do that with a text block, but I suspect there is probably a tidier solution to embedding Youtube videos.

You could use a URL attribute and just paste the url, then have your templates wrap the url in the appropriate embed tags.

There is a youtube extension available from either http://ez.no/developer/contribs or http://projects.ez.no which allows the embedding of Youtube videos.

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck

John Moritz

Monday 27 October 2008 12:35:54 pm

I would do it like Andrew said. Use an URL attribute and just save the URL.
Then you are able to make changes on the embed code.
Maybe give them a choice, to save the url, the Video-ID or the embed code. Saving the Video-ID only would be the best solution, but thats maybe to difficult (not realy but i have seen a lot of weird things...) for some unexperienced internet Users.

As example, you are allowed to choose the size of the youtube player. If you use the embed code, you have to hack the embed code to resize the player on different views. Maybe today you think the width should be 500 px, tomorrow it should be 350 px. If you save the URL you can extract the Video-ID and generate the embed code dynamicly.

This will work on the most Video network Sites i know. There are also a lot of APIĀ“s for youtube and other Sites. Google is your friend.

Matthew Knight

Thursday 30 October 2008 11:02:45 am

thanks for the thoughts - youtube was just one example, there are lots of different embeddable pieces of content which we'd want to support, so it needs to ideally just be the raw HTML. i've found a solution over in another thread about defining a block which you can past raw HTML into:

http://ez.no/developer/forum/setup_design/youtube_object

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 00:30:06
Script start
Timing: Jan 19 2025 00:30:06
Module start 'layout'
Timing: Jan 19 2025 00:30:06
Module start 'content'
Timing: Jan 19 2025 00:30:06
Module end 'content'
Timing: Jan 19 2025 00:30:06
Script end

Main resources:

Total runtime0.0208 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 588.0469152.6406
Module start 'layout' 0.00660.0030 740.687539.4766
Module start 'content' 0.00960.0087 780.164193.3672
Module end 'content' 0.01830.0025 873.531334.3047
Script end 0.0208  907.8359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002813.5861140.0002
Check MTime0.00125.8857140.0001
Mysql Total
Database connection0.00125.932710.0012
Mysqli_queries0.002512.029330.0008
Looping result0.00000.072210.0000
Template Total0.00209.410.0020
Template load0.00115.187510.0011
Template processing0.00094.187810.0009
Override
Cache load0.00083.755610.0008
General
dbfile0.00041.802280.0000
String conversion0.00000.024140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs