MyBB Community Forums

Full Version: Forum Music
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I'm looking for a way in which to embed a youtube video for background music purposes in one particular forum on my website and not globally. Is there any particular way this can be accomplished? I have the embed code for youtube already and can put it in my header and have it play globally but that's a bit much and I'd rather have it playing for one particular forum instead.

Thanks Smile
You could use the PHP in Templates plugin and wrap the YouTube player within an if statement to check if the forum you're in is the one you want the music to play. Like so:

<if $GLOBALS['forum']['fid'] == 1 then>
// YouTube Player
</if>
(2011-07-26, 02:14 PM)faviouz Wrote: [ -> ]You could use the PHP in Templates plugin and wrap the YouTube player within an if statement to check if the forum you're in is the one you want the music to play. Like so:

<if $GLOBALS['forum']['fid'] == 1 then>
// YouTube Player
</if>

Sweet, I actually use that PHP in Templates plug-in. Would I want to add your code to the header?

Here's what I have in my header currently and it doesn't seem to work:

<if $GLOBALS['forum']['fid'] == 49 then>
<!--  Gaben -->
		<object type="application/x-shockwave-flash" style="width:1px; height:1px;" data="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0">
<param name="movie" value="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0" />
</object>
		<!--  Gaben -->
</if>

The forum ID I'd like to have this play in is 49 so I'm assuming I change the "== 1 then>" to "== 49 then>"
Try this instead:

<if $forum['fid'] == 49 then>
<!--  Gaben -->
        <object type="application/x-shockwave-flash" style="width:1px; height:1px;" data="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0">
<param name="movie" value="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0" />
</object>
        <!--  Gaben -->
</if>
(2011-07-26, 05:01 PM)faviouz Wrote: [ -> ]Try this instead:

<if $forum['fid'] == 49 then>
<!--  Gaben -->
        <object type="application/x-shockwave-flash" style="width:1px; height:1px;" data="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0">
<param name="movie" value="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0" />
</object>
        <!--  Gaben -->
</if>

Thanks, that doesn't appear to work either Sad
Where are you adding the code?
(2011-07-26, 05:15 PM)faviouz Wrote: [ -> ]Where are you adding the code?

I'm adding it to the bottom of my header template.
Remove it and add the code to your forumdisplay template after {$header}.
(2011-07-26, 05:18 PM)faviouz Wrote: [ -> ]Remove it and add the code to your forumdisplay template after {$header}.

Thanks, though still not working heh.
This should work, I tested it myself:

<if $GLOBALS['forum']['fid'] == 49 || $GLOBALS['foruminfo']['fid'] == 49 then>
        <!--  Gaben -->
        <object type="application/x-shockwave-flash" style="width:1px; height:1px;" data="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0">
<param name="movie" value="http://www.youtube.com/v/BuEmqceeKOM?rel=0&amp;loop=0&amp;autoplay=1&amp;showsearch=0&amp;showinfo=0" />
</object>
        <!--  Gaben -->
</if>
Pages: 1 2