[PHP] Suche "Banner"script

Dieses Thema im Forum "Webentwicklung" wurde erstellt von Dat Inge, 11. Oktober 2007 .

  1. 11. Oktober 2007
    Suche "Banner"script

    Ich hatte mal irgendwo ein Bannerscript welches aus Ordner "xyz" automatisch die Banner gelesen hat, diese mit einer vorbestimmten Url verlinkt hat und als Rotation angezeigt hatte. Zudem kam das in der Leiste dann oben stand
    "http://www.xxx.de/ads.php" und nicht der eigentliche Reflink.
    Habt ihr noch soein Script rumliegen?
     
  2. 11. Oktober 2007
    Zuletzt von einem Moderator bearbeitet: 15. April 2017
    AW: Suche "Banner"script

    ich hatt hier grad ne alte klasse rumliegen.
    funktionsweiße is eigendlich kla.

    viel spaß

    PHP:
    <? php
        
    class  add_switcher  {
            private 
    $adds  = array();
            private 
    $outputs  = array();
            private 
    $templates  = array();
            
            public function 
    new_add ( $link $attributes  null ) {
                if(
    is_array ( $link )) {
                    foreach(
    $link  AS  $l  =>  $a ) {
                        
    $this -> adds [ $l ] = array(
                            
    'link'  =>  $l ,
                            
    'arrtibutes'  =>  $a
                        
    );
                    }
                }
                else {
                    
    $this -> adds [ $link ] = array(
                        
    'link'  =>  $link ,
                        
    'attributes'  =>  $arrtibutes
                    
    );
                }
                
                
    $this -> _create_ad ( $link $attributes );
            }
            
            private function 
    _create_ad ( $link $attributes  null ) {
                if(
    is_array ( $link )) {
                    foreach(
    $link  AS  $l  =>  $a ) {
                        
    $template  $a [ 'outer_html' ];
                        unset(
    $a [ 'outer_html' ]);
                        
    $lt  $l ;
                        
    $l  $this -> _set_attributes ( $l $a );
                        
    $template  str_replace ( '{add}' $l $template );            
                        
    $this -> templates [ $lt ] =  $template ;
                    }
                }
                else {
                    
    $template  $attributes [ 'outer_html' ];
                    unset(
    $attributes [ 'outer_html' ]);
                    
    $linkt  $link ;
                    
    $link  $this -> _set_attributes ( $link $attributes );
                    
    $template  str_replace ( '{add}' $link $template );
                    
    $this -> templates [ $linkt ] =  $template ;
                }
            }
            
            private function 
    _set_attributes ( $link $attributes ) {
                if(!
    is_array ( $attributes )) return  '<a href="' . $link . '" target="blank">' . $link . '</a>' ;
                else {
                    
    $l      '<a href="' . $link . '" target="' .(( $attributes [ 'link_target' ] == '' ) ?  'blank'  $attibutes [ 'link_target' ]). '">' ;
                    
    $l  .= 
                    ((
    $attributes [ 'image_src' ] != '' )
                        ?
                            
    '<img src="' . $attributes [ 'image_src' ]. '" alt="' .
                            ((
    $attributes [ 'image_alt' ] != '' )
                                ?
                                    
    $attributes [ 'image_alt' ]
                                :
                                    
    $link
                            
    )
                            .
    '" border="' .
                            ((
    $attributes [ 'image_border' ] ==  '' )
                                ?
                                    
    '0'
                                
    :
                                    
    $attributes [ 'image_border' ]
                            )
                            .
    '" ' .
                            ((
    $attributes [ 'image_style' ] != '' )
                                ?
                                    
    'style="' . $attributes [ 'image_style' ]. '"'
                                
    :
                                    
    ''
                            
    )
                            .
                            ((
    $attributes [ 'image_title' ] != '' )
                                ?
                                    
    'title="' . $attributes [ 'image_title' ]. '"'
                                
    :
                                    
    ''
                            
    )
                            .
    ' />'
                        
    :
                            
    $link
                    
    ). '</a>' ;
                    
                    return 
    $l ;
                }
            }
            
            public function 
    display ( $name  '' $ret  0 ) {
                if(
    $name  ==  '' $dadd [ 'link' ] =  array_rand ( $this -> adds );
                else {
                    if(
    is_numeric ( $name )) {
                        
    $i = 0 ;
                        foreach(
    $this -> adds  AS  $add ) {
                            if(
    $i  ==  $name ) {
                                
    $dadd  $add ;
                                break;
                            }
                            else 
    $i ++;
                        }
                    }
                    else 
    $dadd  $this -> adds [ $name ];
                }
        
                if(
    $dadd  ==  ''  &&  $ret  ==  0 $this -> display ( 0 , 1 );
                elseif(
    $ret  ==  &&  $dadd  ==  '' user_error ( 'no adds found!' );
                else {
                    print 
    $this -> templates [ $dadd [ 'link' ]];
                }
            }
        }
        
        
    $test  = new  add_switcher ;
        
    $test -> new_add ( ray (
                
    'outer_html'  =>  '{add}'
                
    'image_src'  =>  d . raidrush . ws / customavatars / avatar14772_1 . gif ',
                '
    image_border ' => 5,
                '
    image_style ' => ' border - color #bf0000;',
                
    'image_title'  =>  'huha!'
            
    )
        );
        
    $test -> new_add ( ray ( 'outer_html'  =>  '{add}' ));
        
    $test -> new_add ( ray ( 'outer_html'  =>  '{add}' ));
        
    $test -> new_add ( ray ( 'outer_html'  =>  '{add}' ));
        
    $test -> display ();
    ?>
     
  3. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.