Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • odpearl Friend
    #135565

    Hi,

    How do i modify this template:

    I have a folder with many pictures , what i want is:

    For the background will change
    every time someone goes into the website. The background should change randomly from the folder of pictures.

    How can i do this? and who can explain it to me step by step because I am not a professional.

    Thank you.

    Anonymous Moderator
    #280105

    Dear odpearl,

    Please view my guide:

    + Open file templates/ja_sanidineii_light/index.php for sanidine ii or templates/ja_sanidine/index.php for sanidine template, at about line 74, find following script:

    <?php
    //populate background for body
    $bodybg = $tmpTools->getParam('ja_bodybg');
    if ($bodybg) {
    $bodybg = " style="background-image: url(".$tmpTools->templateurl()."/images/background/$bodybg);"";
    }
    ?>

    and change to:

    <?php
    //populate background for body
    $backgound_folder = 'images/background/'; //Path to background folder
    $dir=opendir($backgound_folder);
    $files = array();
    $k = 0;
    while(($file = readdir($dir)) !== false) {
    // check extension if you want
    if($file != '.' && $file != '..' && !is_dir($backgound_folder.$file)) {
    $files[$k] = $file;
    $k++;
    }
    }
    closedir($dir);

    $rd = rand(0,$k - 1);
    if(isset($files[$rd])){
    $bodybg = $files[$rd];
    if ($bodybg) {
    $bodybg = " style="background-image: url(images/background/$bodybg);"";
    }
    } else {
    $bodybg = $tmpTools->getParam('ja_bodybg');
    if ($bodybg) {
    $bodybg = " style="background-image: url(".$tmpTools->templateurl()."/images/background/$bodybg);"";
    }
    }

    /*if ($bodybg) {
    $bodybg = " style="background-image: url(".$tmpTools->templateurl()."/images/background/$bodybg);"";
    }*/
    ?>

    Hope it help

    odpearl Friend
    #280131

    HI,
    Thank you for answer, but got error:

    Warning: opendir(images/background/): failed to open dir: No such file or directory in /home/content/m/b/p/mbpartydesign/html/test2/templates/ja_sanidineii_light/index.php on line 76

    Warning: readdir(): supplied argument is not a valid Directory resource in /home/content/m/b/p/mbpartydesign/html/test2/templates/ja_sanidineii_light/index.php on line 79

    Warning: closedir(): supplied argument is not a valid Directory resource in /home/content/m/b/p/mbpartydesign/html/test2/templates/ja_sanidineii_light/index.php on line 86

    Thanks.

    scotty Friend
    #280145

    You need to create your Background folder in your Images folder and place your images in there.

    odpearl Friend
    #280147

    Thank you .

    Fix the missing “r”.

    Stil two errors:

    Warning: readdir(): supplied argument is not a valid Directory resource in /home/content/m/b/p/mbpartydesign/html/test2/templates/ja_sanidineii_light/index.php on line 79

    Warning: closedir(): supplied argument is not a valid Directory resource in /home/content/m/b/p/mbpartydesign/html/test2/templates/ja_sanidineii_light/index.php on line 86

    I created folder imagesbackground still not lucky

    Thanks

    scotty Friend
    #280148

    lol… the missing ‘r’ was not a mistake. Well it might be but it’s missing in the rest of the argument so it doesn’t matter.

    Take it back out and try again.

    odpearl Friend
    #280150

    Thank you VERY much.

    Working Perfectly .

    matt2047 Friend
    #281817

    I’ve got the same problem (sort of).

    What “r” are you guys mentioning; I can’t find that. I just really want to specify one background image for the entire site, but am having no luck on that background-image line…

    Thanks for any assist.

    Cheers,

    matt2047

    odpearl Friend
    #281833

    Hi,

    Don’t look for my mistake with ” r “

    Just follow this :

    1. create folder “background” under folder “images”
    2. put some picture with same resolution as 1600x 2000 or more
    3. change the code how JA Developer say in post #2

    Hope this help

    Rob Hawthorn Friend
    #282471

    <em>@odpearl 94190 wrote:</em><blockquote>Hi,

    Don’t look for my mistake with ” r “

    Just follow this :

    1. create folder “background” under folder “images”
    2. put some picture with same resolution as 1600x 2000 or more
    3. change the code how JA Developer say in post #2

    Hope this help</blockquote>
    Hi,
    I’ve just inserted the new code, uploaded the new image and index.php to the correct paths (and deleted the other files in that folder), what does the background image file have to be called because I’ve lost the background image now when viewing my site in a browser

    matt2047 Friend
    #282477

    Rob,

    I edited the ja_vars_1.0x.php file that is mentioned here: http://www.joomlart.com/forums/topic/how-to-configure-joomlart-templates/

    Set that file it’s referencing for the background to “example.jpg” and then make sure to place that same file in the images/background folder. You’ll see the other files for this template (sl-1, sl-2, etc.) listed in there as well.

    Let me know if this works out okay for you.

    matt2047

    matt2047 Friend
    #282478

    I think by default, this template references “beach.jpg” for the background. So, look for that piece of code in the ja_vars_1.0x.php file.

    Rob Hawthorn Friend
    #282600

    Hi Matt,
    Thanks for the reply, I appreciate it I have to admit though that I’m getting slightly frustrated (not with you, with the actual template solution).

    The background image file name is obviously referenced somewhere in the files but using CTRL+F I’m looking for “gaming-02.jpg” which is the file referenced but dreamweaver is not picking it up anywhere. FYI the background code is not in “ja_vars_1.0x.php” (although I am using j1.5 but is should be similar.

    Just to reiterate I’m not having a go at you Matt, just thinking it should not be this difficult to change the background image. Sorry for the rant.

    I’ll press on with the code modification as suggested.

    matt2047 Friend
    #282622

    Hi Rob,

    Don’t worry – I felt the exact same frustration myself with this particular template. I think the user guide could have been a lot more striaghtforward in how to edit simple stuff like this!

    According to this link http://www.joomlart.com/forums/topic/ja-sanidine-userguide/ (configuring Sanidine for J1.5), you go into the template manager and change the “Body Background” to your image file. Now, I’m using J1.0 so I have no idea if that’s true or not, and you’ve probably already tried that, right?

    What worked for me to find out where my background image was being called from was, I looked at the page source from Firefox, and then opened the ja_vars_1.0x.php file in Dreamweaver and found that line of code. That same link says that it could also be ja_vars.php, depending on the Joomla version/template.

    Sorry, that’s my entire experience with this template, wish I could be of better assistance. Feel free to let me know if you need help with any other particulars, and best of luck!

    matt2047

    Rob Hawthorn Friend
    #282677

    <em>@matt2047 95104 wrote:</em><blockquote>Hi Rob,

    Don’t worry – I felt the exact same frustration myself with this particular template. I think the user guide could have been a lot more striaghtforward in how to edit simple stuff like this!

    According to this link http://www.joomlart.com/forums/topic/ja-sanidine-userguide/ (configuring Sanidine for J1.5), you go into the template manager and change the “Body Background” to your image file. Now, I’m using J1.0 so I have no idea if that’s true or not, and you’ve probably already tried that, right?

    What worked for me to find out where my background image was being called from was, I looked at the page source from Firefox, and then opened the ja_vars_1.0x.php file in Dreamweaver and found that line of code. That same link says that it could also be ja_vars.php, depending on the Joomla version/template.

    Sorry, that’s my entire experience with this template, wish I could be of better assistance. Feel free to let me know if you need help with any other particulars, and best of luck!

    matt2047</blockquote>
    Yes Matt that’s exactly right about the template manager…….I know, it was as easy as that 🙂

    Cheers for taking the time to help it’s very much appreciated

Viewing 15 posts - 1 through 15 (of 15 total)

This topic contains 15 replies, has 5 voices, and was last updated by  Rob Hawthorn 15 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum