test
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • damonwilder Friend
    #154812

    Hi Folks,

    maybe these problem is solved somewhere, but I doesn’t found the answer by searching this forum.

    You know that in Purity II the header images rotate by a random generator. Now I won’t this. I’ve 2 categories on my homepage and I want Image1 by clicking on Menulink1 and Image2 by clicking on Menulink2.

    Is this possible?

    Thanks
    DamonWilder

    Don Lee Friend
    #358193

    <em>@damonwilder 196333 wrote:</em><blockquote>Hi Folks,

    maybe these problem is solved somewhere, but I doesn’t found the answer by searching this forum.

    You know that in Purity II the header images rotate by a random generator. Now I won’t this. I’ve 2 categories on my homepage and I want Image1 by clicking on Menulink1 and Image2 by clicking on Menulink2.

    Is this possible?

    Thanks
    DamonWilder</blockquote>

    Hi,
    What’s about header image as you mentioned? Did you mean it’s menu image?

    damonwilder Friend
    #374242

    Hi,

    I mean following images: […]/templates/ja_purity_ii/images/header/header[1-3].jpg
    This 3 images should not change randomly, but by the categories. For Example: Klick on tab#1 -> image1; Klick on tab#2 -> image2, and so on.

    Many thanx for your answers.
    Would be nice, if this could work.

    Saguaros Moderator
    #374517

    Yes, mate!

    Presently, header images are displayed in the random way. You can try the following to complete your idea

    1) open the templates/ja_purity_ii/libs/ja.templates.helper.php and find the following code:
    [PHP]
    function getRandomImage ($img_folder) {
    if (!is_dir ($img_folder)) return ”;
    $imglist=array();

    mt_srand((double)microtime()*1000);

    //use the directory class
    $imgs = dir($img_folder);

    //read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)
    while ($file = $imgs->read()) {
    if (eregi(“gif”, $file) || eregi(“jpg”, $file) || eregi(“png”, $file))
    $imglist[] = $file;
    }
    closedir($imgs->handle);

    if(!count($imglist)) return ”;

    //generate a random number between 0 and the number of images
    $random = mt_rand(0, count($imglist)-1);
    $image = $imglist[$random];

    return $image;
    }
    [/PHP]replace:

    [PHP]
    function getRandomImage ($img_folder) {
    if (!is_dir ($img_folder)) return ”;
    $imglist=array();

    mt_srand((double)microtime()*1000);

    //use the directory class
    $imgs = dir($img_folder);
    $itemID = (int)JRequest::getVar(‘Itemid’,0);
    //read all files from the directory, checks if are images and ads them to a list (see below how to display flash banners)
    while ($file = $imgs->read()) {
    if (eregi(“gif”, $file) || eregi(“jpg”, $file) || eregi(“png”, $file))
    $imglist[] = $file;
    if( $file == ‘header-‘.$itemID.’.jpg’ ){
    closedir($imgs->handle);
    return $file;
    }
    }
    closedir($imgs->handle);

    if(!count($imglist)) return ”;

    //generate a random number between 0 and the number of images
    $random = mt_rand(0, count($imglist)-1);
    $image = $imglist[$random];

    return $image;
    }

    [/PHP]when done,

    rename your images in this format:

    header-+ValueOf ItemId+”.jpg”

    gizmotix Friend
    #410736

    Since this thread is already 8 months old, the posted idea doesnt work any more for the newest version.

    The solution seems to be simple by replacing the “rand(1,3)”-php command in head.php, but i don’t know how to insert the ID of the current category instead.

    Could someone tell me, which php-variable contains the category-ID ?

    /templates/ja_purity_ii/blocks/head.php

    #ja-header .main {
    background-image: url(<?php echo T3Path::getUrl('/images/header/header'. rand(1,3).'.jpg'); ?>);
    }

    Thanks in advance 🙂

    jooservices Friend
    #410737

    Hi
    Please make new thread for another issue . It could help us easier for maintaince and follow up.
    Thank you
    Viet Vu

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

This topic contains 6 replies, has 5 voices, and was last updated by  jooservices 13 years, 3 months ago.

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