SimplePortal
Support => English Support => Topic started 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.
-
Really would like some info on this one :).
-
Rush,
Create a custom php block.
This is a method using embed which is not w3c compliant:
/* 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:
/* 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>';
-
Thank you UnderDog for replying.
-
Thank you UnderDog for replying.
Rush,
Not a problem.
Did one of those blocks solve your dilemma?
-
And er Rush try not to be so impatient eh?
Ya should asked me ya daft pup.
/me says 'Sheesh kids'
-
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?
-
$video_id = 'M44BOaD98L8';
You only need the number.
-
Cool :), I made only one mistake, erm old fossil care to help me with this ;).
-
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.
-
Does Underdogs reply make sense to ya kiddo?
I'll be logging off soon ( 6am in UK)
-
Thanks guys, and yeah it does thanks guys again ;).
-
Rush,
If you have found the answer to your issue please let us know & mark the topic as solved.
Thank you.
-
Okay will do ;), if i have any further problems, i'll reopen this topic again :).
-
Done thanks guys ;). Sonic My friend gives you guys a huge thumbs up ;).
-
They give you a youtube code for embedding i believe its html
Create a html block and add that code
LOL
-
They give you a youtube code for embedding i believe its html
Create a html block and add that code
LOL
Not neccessarily.
-
Actually the html block with the embed code is probably the simplest way - I use it.
-
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
-
Not if you add the videos to your media mod first.
-
Umm this topic is solved lol :P.
-
Mark it as solved please?
-
Mark it as solved please?
Er he already has.
-
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)
/* 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>';
-
Sorry didnt notice that you marked it as solved
-
that's cool :D.