GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 5,102

0 members and 5,102 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    123

    Exclamation

    Okay this is some small link generator which i use on my personal website

    Lets start with creating an array.. and put out few sites..
    Code:
    <?php
    $links = array();
    $links[] = "http://www.gfxvoid.com;GFXvoid";
    $links[] = "http://www.eagleimg.com;EagleImg";
    $links[] = "http://www.imageshack.us;ImageShack;";
    $links[] = "http://www.imghost.com;ImgHost";
    $links[] = "http://www.ebaumsworld.com;eBaum's World";
    $links[] = "http://www.afterdawn.com;AfterDawn";
    $links[] = "http://www.letssingit.com;LetsSingIt";
    $links[] = "http://www.sourceforge.net;SourceForge";
    $links[] = "http://www.good-tutorials.com/;Good-Tutorials";
    $links[] = "http://www.pixel2life.com;Pixel2Life";
    $links[] = "http://www.big-boys.com/;Big-Boys";
    now as you can see we have list of websites and their title..
    next up we are going to pick randomly one of those using array_rand command

    Code:
    $random = array_rand($links);
    now $random stands for a random link line from list above
    next we need to separate URL from the title.. and as you can see there is ";" between em.. so we explode ";"
    Code:
    $first_rlink = explode(";", $links[$random1]);
    now we need to output the result...or random link anyhow..
    Code:
    echo "<a href='$first_rlink[0]'>$first_rlink[1]</a>";
    ?>
    Now this is done I'll show the full code below.. you can make this different like random 2 different link but remember it can output same link.. actually i have 2 link gen on my site and those can't be the same.. but i ain't gonna show how it's do

    Author: NightStalker
    Difficulty: Easy

    Code:
    <?php
    $links = array();
    $links[] = "http://www.gfxvoid.com;GFXvoid";
    $links[] = "http://www.eagleimg.com;EagleImg";
    $links[] = "http://www.imageshack.us;ImageShack;";
    $links[] = "http://www.imghost.com;ImgHost";
    $links[] = "http://www.ebaumsworld.com;eBaum's World";
    $links[] = "http://www.afterdawn.com;AfterDawn";
    $links[] = "http://www.letssingit.com;LetsSingIt";
    $links[] = "http://www.sourceforge.net;SourceForge";
    $links[] = "http://www.good-tutorials.com/;Good-Tutorials";
    $links[] = "http://www.pixel2life.com;Pixel2Life";
    $links[] = "http://www.big-boys.com/;Big-Boys";
    
    $random = array_rand($links);
    $first_rlink = explode(";", $links[$random1]);
    
    echo "<a href='$first_rlink[0]'>$first_rlink[1]</a>";
    ?>

  2. #2
    Join Date
    May 2005
    Location
    Sweden
    Posts
    345

    Default

    Can be useful for a "Random Affilates Tab".
    The thing is i can't use php on my server..
    Noooooo! My old signature is gone! Gone forever!!!
    *sniff*
    New one!

  3. #3
    Join Date
    Feb 2005
    Posts
    123

    Default

    too bad for you elite.. and i agree this can be used for Random Affilates.. but i just use this on my website to show good links and stuff

  4. #4
    Join Date
    Jul 2005
    Posts
    15

    Default

    array_out = array_rand( array, count ); to make sure that links are unique and don`t double. If you have 3 links in your array, then array_rand( $your_array, 2 ) will return array with 2 different elements.

    Originally posted by 1337elite@43 Minutes Ago
    The thing is i can't use php on my server..
    Why not?

  5. #5
    Join Date
    May 2005
    Location
    Sweden
    Posts
    345

    Default

    W00t!
    Now i'm able to use PHP on my host! Yay!
    I <3 scripting&#33;
    Noooooo! My old signature is gone! Gone forever!!!
    *sniff*
    New one!

Similar Threads

  1. Image Generator
    By Wade in forum Other Tutorials
    Replies: 7
    Last Post: 09-04-2006, 09:56 PM
  2. terrain generator
    By nosferatu in forum Digital Art
    Replies: 2
    Last Post: 12-15-2005, 01:34 PM
  3. Random Image Generator
    By Void.x in forum Other Tutorials
    Replies: 12
    Last Post: 07-29-2005, 08:22 AM
  4. Error Message Generator
    By the_dude_of_darkness in forum The Void
    Replies: 8
    Last Post: 06-18-2005, 10:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1