Fork me on GitHub

Background Music on a theme ?  Bottom

Go to page 1 - 2 [+1]:

  • Is it possible to add background music to a particular theme ?
    If so can anyone tell me what code to use and where exactly to place it in my theme ?

    Thanks a bunch !
  • For heaven's sake, please don't!!!

    :)

    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Yeah, I concur... Themes are just like HTML mixed with a bit o' PHP so you can just add the usual HTML you would use to include bg music to the appropriate part of the theme (often within the tag of the themeheader())....

    Perhaps you could limit the bg music by having it only on the home/news page... i.e.

    Code

    if $GLOBALS['index'] == 1{
        // Code for bg music
    }


    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • The Javascript Source features lots of nice scripts for handling bg music - http://javascript.internet.com
  • I know very little about PHP unfortunately and am still having problems locating where to place this code?
    Can you be more specific as to what file or page I need to place this code ..I've tried several places and keep getting error codes ?

    Thanks again for all your help
  • In the theme.php of the theme you are using in the function mentioned above... Actually I forgot the parenthesis around the code, it should be:

    Code

    if ($GLOBALS['index'] == 1) {
        // Code for bg music
    }

    You'll have to either "echo" the code or break out of PHP:

    Code

    if ($GLOBALS['index'] == 1) {
        // Code for bg music
       ?>
       HTML GOES HERE
       <?
    }


    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • got it to work..thanks so much for the help... icon_lol
  • Hi...

    I'm trying to add bg music as well. I have had no luck with getting it to work, but I've had no errors come up either.

    Here is the header template code:

    ------------------------------------------------->
    $thename = "BlackDog";
    $postnuke_theme = true;

    themes_get_language();

    $bgcolor1 = "#18202C";
    $bgcolor2 = "#1F2939";
    $bgcolor3 = "#0A1423";
    $bgcolor4 = "#0A1423";
    $textcolor1 = "#FFFFFF";
    $textcolor2 = "#FFFFFF";

    include ("themes/$thename/tables.php");

    function themeheader()
    {
    global $thename, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $index;



    $slogan = pnConfigGetVar('slogan');
    $sitename = pnConfigGetVar('sitename');
    $banners = pnConfigGetVar('banners');
    $type = pnVarCleanFromInput('type');


    echo "\n";
    echo "\n\n\n";

    //Begin Header
    echo "\n"
    ."\n"
    ."\n"
    ."\n"
    ."\n"
    ."\n"
    ."\n"
    ."\n"
    ."
    \n";


    include("themes/$thename/header.html");

    $chaine_bdog = "0123456789";
    srand((double)microtime()*10);
    for($i=0; $i<1; $i++)
    {
    $image_bdog_1 .= "\n";
    }

    if ($index == 1)
    {
    include("themes/$thename/header_1.html");
    }
    else
    {
    include("themes/$thename/header_2.html");
    }

    echo "
    \n"
    ."\n"
    ."\n"
    ."\n"
    ."
    \n";

    blocks('left');

    echo "
    ";

    if ($index == 1)
    {
    blocks('centre');
    }
    }
    ------------------------------------------------------------>
    Where would I place the code?

    Thanks in advance;

    -Xarcell
  • Look up in Google re: placing background music as there are many methods you can use (Microsoft has BGSOUND, for example)... The HTML in the themeheader corresponds to a regular HTML page.

    Often though, the BGSOUND or EMBED code is placed inside the tags, so in the case of themeheader, you would place it just inside (above) the tag.

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Well browsed the net and really didn't find much help...

    However, I did manage to fidn out why it wasn't working. I didn't realize I needed to place in teh whole URL, eventhough it was in teh same directory.

    Here is the code I used, which was what was suggested above:
    -------------------------------------------->
    if ($GLOBALS['index'] == 1) {
    // Code for bg music
    ?>

  • Xarcell

    I didn't realize I needed to place in the whole URL, even though it was in the same directory.

    You don't - just make the URL's *relative* from the root of your PN pages:

    Code

    themes/BlackDog/music_xTx_1.mp3


    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Ahh...

    Ok.

    But I've encountered another problem. The song only plays on the "home" page. You click a link, and it's stops.

    How do I get it to play through the whole site?

    -Xarcell
  • Nuke the conditional statement surrounding it -- though that might be a little annoying to your guests...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • lo, wow nate you have been alotta help.

    Helping me everywhere.

    But I gotta tell you something. I don't know what a "conditional statement" is...

    ?

    Thanks again man,

    -Xarcell
  • Oy vay - try to be a little more resourceful, eh? It's the *only* thing surrounding it...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...

Go to page 1 - 2 [+1]:

  • 0 users

This list is based on users active over the last 60 minutes.