+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: [TUTORIAL] Rotative Banners in PHP

  1. #11
    DarkDragonLord's Avatar
    DarkDragonLord is offline x10 Elder DarkDragonLord is an unknown quantity at this point
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    782

    Re: [TUTORIAL] Rotative Banners in PHP

    after you place my script, just change the html extension to .php

    if stay in .html, server will not read the <?php tags :P
    Regards,
    Raphael DDL

    Designing Solutions for You
    *Web Design;
    *Coding;
    Free Downloads;
    and all related Stuff
    .


    My Tutorials:
    | Multi-Language Websites | Rotative Banners |
    | Bookmark Script for All Browsers
    |
    |
    PHP Switching/Including Content|
    |


  2. #12
    DarkDragonLord's Avatar
    DarkDragonLord is offline x10 Elder DarkDragonLord is an unknown quantity at this point
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    782

    Re: [TUTORIAL] Rotative Banners in PHP

    .
    JUST AN ADD-ON:


    If you want to add this to everypage of your website, instead of copying/pasting the code on every page, just do a new .php page and paste the code there. Add all things you want and save. NO NEED to put html tags or anything, just put the <?php and the codes, close with ?> and its done.

    Then, in the place you want to add the code in the pages, put:

    Code:
    <?php
    @include("NAME OF THE PHP FILE WITH CODES.php");
    ?>
    Then, everytime that you need to change the code, instead of changing in all files, just change the php with the code.
    AND, the @ before the include is, to when the file you including does not exist, instead of givin that PHP ERROR: include in line xx error etcs and show everyone your acc name (root/XXXX/public_html/etc) , just show nothing. ^^
    Regards,
    Raphael DDL

    Designing Solutions for You
    *Web Design;
    *Coding;
    Free Downloads;
    and all related Stuff
    .


    My Tutorials:
    | Multi-Language Websites | Rotative Banners |
    | Bookmark Script for All Browsers
    |
    |
    PHP Switching/Including Content|
    |


  3. #13
    deadimp is offline x10 Sophmore deadimp is an unknown quantity at this point
    Join Date
    Jun 2007
    Posts
    249

    Re: [TUTORIAL] Rotative Banners in PHP

    Got bored, don't want to do my homework... Here's a compact version:
    PHP Code:
    //Store data in multidimensional array with associative indexes
    $banner=array(
        array(
            
    'img'=>'http://ddl.exofire.net/images/banner2.gif',
            
    'url'=>'www.google.com.br',
            
    'alt'=>'its google lol'),
        array(
            
    'img'=>'http://ddl.exofire.net/images/468x80_banner.gif',
            
    'url'=>'ddl.exofire.net',
            
    'alt'=>'my website')
        );
    //Generate random index
    $index=rand(0,count($banner)-1);
    //Select and reference current banner
    $cur=&$banner[$index];
    //Generate output
    $out="<a href='$cur[url]'><img src='$cur[img]' alt='$cur[alt]'></a>"
    Using just one main array allows the related data to be closer so it isn't so spread out.
    I didn't test it, but it ought to work. Be sure you do something with $out.
    Last edited by deadimp; 11-14-2007 at 11:58 PM.
    deadimp.org
    > Thacmus [v0.3.0] - Open source CMS, PHP 5, MySQL

    "¡Ya lo sabo!" - Lo Ausente

  4. #14
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: [TUTORIAL] Rotative Banners in PHP

    Aside from adding border='0' to the image and inserting a title tag into the href, that pretty much sums it up

    YOu could still use shuffle if you like though.

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  5. #15
    mr kennedy's Avatar
    mr kennedy is offline KENNNNNEEEEDYYY!!!! mr kennedy is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    Doha, State of Qatar
    Posts
    525

    Re: [TUTORIAL] Rotative Banners in PHP

    Quote Originally Posted by Thewinator View Post
    Are you sure its not the templates your looking at?
    Either way you could place an iframe and use DDL's script.
    tried that, the rest of my page doesn't show up

+ Reply to Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 11:07 AM
  2. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 10:16 PM
  3. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 07:28 PM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 03:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers