Looking for a script...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • F U S I O N
    Confirmed User
    • Jan 2006
    • 1898

    #1

    Looking for a script...

    I have a list of 100 urls and descriptions that look like this:

    SiteName.com - This is a description of the above site...

    I want to have a page load and have 20-30 of these links be displayed at a time. Refresh the page and have a different set of 30 links load, all random.

    Any ideas of a script or snippet of code I could use to accomplish this? I searched google but can't seem to find a script that will display the amount of links that I want it to...

    Thanks in advance
  • Swish
    Confirmed User
    • Mar 2006
    • 1421

    #2
    Something like this:

    Code:
    <?php
    
    $ARRAY = array(
        'sitename1.com' => 'This is a description',
        'sitename2.com' => 'This is a description'
        );
    
    foreach ( $ARRAY as $URL => $DESC )
        print "<a href=\"$URL\">$URL</a> - $DESC\n";
    
    ?>


    Naughty America - Director of Technology
    It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
    swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!

    Comment

    • da man
      Confirmed User
      • Nov 2005
      • 2375

      #3
      I love your sig Swish
      Mike Cross : Kink.com : ICQ: 413115769

      Comment

      • F U S I O N
        Confirmed User
        • Jan 2006
        • 1898

        #4
        Thanks Swish!

        How do I go about only displaying a certain amount of links at a time tho out of a bigger list?

        Comment

        • k0nr4d
          Confirmed User
          • Aug 2006
          • 9231

          #5
          Code:
          <?php
          
          $ARRAY = array(
              'sitename1.com' => 'This is a description',
              'sitename2.com' => 'This is a description'
              );
          
          shuffle($ARRAY);
          $counter=0; 
          foreach ( $ARRAY as $URL => $DESC ) {
              if($counter < 30) {
              print "<a href=\"$URL\">$URL</a> - $DESC\n";
              $counter++;
              }
          }
          ?>
          A bit half-assed. I would do this with a mysql db instead.
          Mechanical Bunny Media
          Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

          Comment

          • Emil
            Confirmed User
            • Feb 2007
            • 5658

            #6
            Originally posted by k0nr4d
            A bit half-assed. I would do this with a mysql db instead.
            Sounds pretty unnecessary for such a small script.
            Free 🅑🅘🅣🅒🅞🅘🅝🅢 Every Hour (Yes, really. Free ₿itCoins.)
            (Signup with ONLY your Email and Password. You can also refer people and get even more.)

            Comment

            • F U S I O N
              Confirmed User
              • Jan 2006
              • 1898

              #7
              Thanks, Ill give that a shot

              Comment

              • Swish
                Confirmed User
                • Mar 2006
                • 1421

                #8
                Originally posted by k0nr4d
                Code:
                <?php
                
                $ARRAY = array(
                    'sitename1.com' => 'This is a description',
                    'sitename2.com' => 'This is a description'
                    );
                
                shuffle($ARRAY);
                $counter=0; 
                foreach ( $ARRAY as $URL => $DESC ) {
                    if($counter < 30) {
                    print "<a href=\"$URL\">$URL</a> - $DESC\n";
                    $counter++;
                    }
                }
                ?>
                A bit half-assed. I would do this with a mysql db instead.
                There are obviously more elegant ways to do this. This was only a simple example.


                Naughty America - Director of Technology
                It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
                swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!

                Comment

                • Swish
                  Confirmed User
                  • Mar 2006
                  • 1421

                  #9
                  Originally posted by da man
                  I love your sig Swish
                  LOL Thanks


                  Naughty America - Director of Technology
                  It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
                  swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!

                  Comment

                  Working...