logo_phpBB Ротация

burgazliq

Registered
как да направя logo_phpBB да сложа примерно 10 картинки и да се сменят през определен период от време
 
1. Създай php файл - например random.php и в него напиши този код:

Код:
<?php 


    $folder = '.'; 


    $extList = array(); 
    $extList['gif'] = 'image/gif'; 
    $extList['jpg'] = 'image/jpeg'; 
    $extList['jpeg'] = 'image/jpeg'; 
    $extList['png'] = 'image/png'; 


$img = null; 


if (substr($folder,-1) != '/') { 
    $folder = $folder.'/'; 
} 


if (isset($_GET['img'])) { 
    $imageInfo = pathinfo($_GET['img']); 
    if ( 
        isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) && 
        file_exists( $folder.$imageInfo['basename'] ) 
) { 
    $img = $folder.$imageInfo['basename']; 
} 
} else { 
    $fileList = array(); 
    $handle = opendir($folder); 
    while ( false !== ( $file = readdir($handle) ) ) { 
        $file_info = pathinfo($file); 
        if ( 
            isset( $extList[ strtolower( $file_info['extension'] ) ] ) 
) { 
            $fileList[] = $file; 
        } 
    } 
    closedir($handle); 


    if (count($fileList) > 0) { 
        $imageNumber = time() % count($fileList); 
        $img = $folder.$fileList[$imageNumber]; 
    } 
} 
if ($img!=null) { 
    $imageInfo = pathinfo($img); 
    $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; 
    header ($contentType); 
    readfile($img); 
} else { 
    if ( function_exists('imagecreate') ) { 
        header ("Content-type: image/png"); 
        $im = @imagecreate (100, 100) 
            or die ("Cannot initialize new GD image stream"); 
        $background_color = imagecolorallocate ($im, 255, 255, 255); 
        $text_color = imagecolorallocate ($im, 0,0,0); 
        imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color); 
        imagepng ($im); 
        imagedestroy($im); 
    } 
} 
?>

2. Създай някаква директория - например head_images и в нея качи random.php и всички изображения, които искаш да се въртят.

3. Накрая отвори overral_header.tpl файла (в темплейт subSilver) и намери:

Код:
<img src="templates/subSilver/images/logo_phpBB.gif" border="0" alt="{L_INDEX}" vspace="1" />

и го замени с:

Код:
<img src="www.твоя_сайт.цом/пътят до random.php/random.php" border="0" alt="{L_INDEX}" vspace="1" />
 
само да попитам
1. Създай php файл - например random.php и в него напиши този код:
каде да го поставя точно този фаил?
 
admin каза:
А защо не ползваш това:

http://web-tourist.net/login/login/view.php?st=827

защото не разбирам
и незнам как да го напрая това да се показва на мястото на логото
на форума
с по горното ще се оправя сама кажете плс каде са го сложа файла като го
създам
 
pszone каза:
1. Създай php файл - например random.php и в него напиши този код:

Код:
<?php 


    $folder = '.'; 


    $extList = array(); 
    $extList['gif'] = 'image/gif'; 
    $extList['jpg'] = 'image/jpeg'; 
    $extList['jpeg'] = 'image/jpeg'; 
    $extList['png'] = 'image/png'; 


$img = null; 


if (substr($folder,-1) != '/') { 
    $folder = $folder.'/'; 
} 


if (isset($_GET['img'])) { 
    $imageInfo = pathinfo($_GET['img']); 
    if ( 
        isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) && 
        file_exists( $folder.$imageInfo['basename'] ) 
) { 
    $img = $folder.$imageInfo['basename']; 
} 
} else { 
    $fileList = array(); 
    $handle = opendir($folder); 
    while ( false !== ( $file = readdir($handle) ) ) { 
        $file_info = pathinfo($file); 
        if ( 
            isset( $extList[ strtolower( $file_info['extension'] ) ] ) 
) { 
            $fileList[] = $file; 
        } 
    } 
    closedir($handle); 


    if (count($fileList) > 0) { 
        $imageNumber = time() % count($fileList); 
        $img = $folder.$fileList[$imageNumber]; 
    } 
} 
if ($img!=null) { 
    $imageInfo = pathinfo($img); 
    $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; 
    header ($contentType); 
    readfile($img); 
} else { 
    if ( function_exists('imagecreate') ) { 
        header ("Content-type: image/png"); 
        $im = @imagecreate (100, 100) 
            or die ("Cannot initialize new GD image stream"); 
        $background_color = imagecolorallocate ($im, 255, 255, 255); 
        $text_color = imagecolorallocate ($im, 0,0,0); 
        imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color); 
        imagepng ($im); 
        imagedestroy($im); 
    } 
} 
?>

2. Създай някаква директория - например head_images и в нея качи random.php и всички изображения, които искаш да се въртят.

3. Накрая отвори overral_header.tpl файла (в темплейт subSilver) и намери:

Код:
<img src="templates/subSilver/images/logo_phpBB.gif" border="0" alt="{L_INDEX}" vspace="1" />

и го замени с:

Код:
<img src="www.твоя_сайт.цом/пътят до random.php/random.php" border="0" alt="{L_INDEX}" vspace="1" />

ДА ТОВА РАБОТИ А КАК Е ДА СЕ СЛОЖИ НАИ ОТГОРЕ НАД МЕНЮТО ДА СИ СТОИ И ВСЯКА КАРТИНКА ДА СИ ИМА ОТДЕЛЕН URL
 
Да, работи, но съм се объркал и не съм те разбрал правилно, защото по този начин ти се сменят картинките при рефреш, а не на време. Това, което търсиш, admin го е предложил - http://web-tourist.net/login/login/view.php?st=827 Ще ти свърши работата, която искаш - различни изображения, които се сменят на време и всяка картинка е линк към различен адрес, който ти определяш.
 

Горе