SimplePortal

Support => English Support => Topic started by: KnightRaider on June 05, 2012, 05:56:35 PM

Title: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 05, 2012, 05:56:35 PM
Hey there guys just a newb question here, how do i put a YouTube video using a portal block for my home? Would really like to do that.
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 05, 2012, 06:00:24 PM
Really would like some info on this one :).
Title: Re: How to put youtube video on the portal using a block?
Post by: Chen Zhen on June 06, 2012, 12:29:00 AM
Rush,

Create a custom php block.

This is a method using embed which is not w3c compliant:
Code: [Select]
/* Adjust video ID & dimensions */
$video_id = 'M44BOaD98L8';
$width = 425;
$height = 344;

echo '
<div style="text-align:center;">
<object width="'.$width.'" height="'.$height.'">
<param name="movie" value="http://www.youtube.com/v/'.$video_id.'"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/'.$video_id.'" type="application/x-shockwave-flash" wmode="transparent" width="'.$width.'" height="'.$height.'"></embed>
</object>
</div>';



Here is another code that does the same thing but should pass w3c validation:
Code: [Select]
/* Adjust video ID & dimensions */
$video_id = 'M44BOaD98L8';
$width = 425;
$height = 344;

echo '
<div style="text-align:center;">
<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$video_id.'" width="'.$width.'" height="'.$height.'" id="VideoPlayback">
<param name="movie" value="http://www.youtube.com/v/'.$video_id.'" />
<param name="allowScriptAcess" value="sameDomain" />
<param name="quality" value="best" />
<param name="bgcolor" value="#FFFFFF" />
<param name="scale" value="noScale" />
<param name="salign" value="TL" />
<param name="FlashVars" value="playerMode=embedded" />
</object>
</div>';
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 06, 2012, 12:44:43 AM
Thank you UnderDog for replying.
Title: Re: How to put youtube video on the portal using a block?
Post by: Chen Zhen on June 06, 2012, 12:46:29 AM
Thank you UnderDog for replying.

Rush,

Not a problem.

Did one of those blocks solve your dilemma?
Title: Re: How to put youtube video on the portal using a block?
Post by: Old Fossil on June 06, 2012, 12:53:35 AM
And er Rush try not to be so impatient eh?

Ya should asked me ya daft pup.

/me says 'Sheesh kids'
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 06, 2012, 12:57:30 AM
I tried the one underneath the other one and it seemed to show fine, but the YouTube video played another video instead? I put the URL in but it just plays another video, were do i put my YouTube URL?
Title: Re: How to put youtube video on the portal using a block?
Post by: Old Fossil on June 06, 2012, 12:58:48 AM
Quote
$video_id = 'M44BOaD98L8';

You only need the number.
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 06, 2012, 01:00:13 AM
Cool :), I made only one mistake, erm old fossil care to help me with this ;).
Title: Re: How to put youtube video on the portal using a block?
Post by: Chen Zhen on June 06, 2012, 01:00:31 AM
I tried the one underneath the other one and it seemed to show fine, but the YouTube video played another video instead? I put the URL in but it just plays another video, were do i put my YouTube URL?

The only thing you need to adjust is the video id and your desired dimensions (width & height).
I put those 3 things at the start of the block code.

The youtube video ID is located in the url.. you do not need to include the whole url or adjust url's in the block code.
Adjust the video id only.
Title: Re: How to put youtube video on the portal using a block?
Post by: Old Fossil on June 06, 2012, 01:02:17 AM
Does Underdogs reply make sense to ya kiddo?

I'll be logging off soon ( 6am in UK)
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 06, 2012, 01:02:58 AM
Thanks guys, and yeah it does thanks guys again ;).
Title: Re: How to put youtube video on the portal using a block?
Post by: Chen Zhen on June 06, 2012, 01:05:08 AM
Rush,

If you have found the answer to your issue please let us know & mark the topic as solved.

Thank you.
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 06, 2012, 01:06:29 AM
Okay will do ;), if i have any further problems, i'll reopen this topic again :).
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 06, 2012, 01:08:58 AM
Done thanks guys ;). Sonic My friend gives you guys a huge thumbs up ;).
Title: Re: How to put youtube video on the portal using a block?
Post by: Mstcool on June 08, 2012, 11:20:54 PM
They give you a youtube code for embedding i believe its html
Create a html block and add that code

LOL
Title: Re: How to put youtube video on the portal using a block?
Post by: Old Fossil on June 08, 2012, 11:22:47 PM
They give you a youtube code for embedding i believe its html
Create a html block and add that code

LOL

Not neccessarily.
Title: Re: How to put youtube video on the portal using a block?
Post by: andy on June 09, 2012, 04:32:09 AM
Actually the html block with the embed code is probably the simplest way - I use it.
Title: Re: How to put youtube video on the portal using a block?
Post by: Mstcool on June 09, 2012, 03:35:50 PM
Yea thats what i do to
Its easy takes 2mins and i can have more then 5 videos up in 2mins rather then doing the php code thing
Title: Re: How to put youtube video on the portal using a block?
Post by: Old Fossil on June 09, 2012, 06:55:01 PM
Not if you add the videos to your media mod first.
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 09, 2012, 08:19:53 PM
Umm this topic is solved lol :P.
Title: Re: How to put youtube video on the portal using a block?
Post by: Mstcool on June 09, 2012, 09:06:32 PM
Mark it as solved please?
Title: Re: How to put youtube video on the portal using a block?
Post by: Old Fossil on June 09, 2012, 09:08:05 PM
Mark it as solved please?

Er he already has.
Title: Re: How to put youtube video on the portal using a block?
Post by: Chen Zhen on June 10, 2012, 01:56:51 AM
People can opt whichever method is preferred and imo the php block is more flexible.

ie. it can easily be adjusted to play random video ID's from an array.
.. or add more php to play videos from multiple sources

ie. random youtube video (from array of video ID's)
Code: [Select]
/* Adjust video IDs & dimensions */
$video_ids = array('M44BOaD98L8', 'i6ic6qfgPIo', '2matH4B9bTo', '6Eo766iZZ0c');
shuffle($video_ids);
$width = 425;
$height = 344;

echo '
<div style="text-align:center;">
<object type="application/x-shockwave-flash"
  data="http://www.youtube.com/v/'.$video_ids[0].'"
  width="'.$width.'" height="'.$height.'" id="VideoPlayback">
  <param name="movie"
    value="http://www.youtube.com/v/'.$video_ids[0].'" />
  <param name="allowScriptAcess" value="sameDomain" />
  <param name="quality" value="best" />
  <param name="bgcolor" value="#FFFFFF" />
  <param name="scale" value="noScale" />
  <param name="salign" value="TL" />
  <param name="FlashVars" value="playerMode=embedded" />
</object>
</div>';
Title: Re: How to put youtube video on the portal using a block?
Post by: Mstcool on June 10, 2012, 11:23:37 PM
Sorry didnt notice that you marked it as solved
Title: Re: How to put youtube video on the portal using a block?
Post by: KnightRaider on June 11, 2012, 07:27:39 AM
that's cool :D.
SimplePortal 2.3.8 © 2008-2024, SimplePortal