How can this be achieved?

Discussion in 'OT Technology' started by jayrod, Jul 29, 2003.

  1. jayrod

    jayrod Lurker extraordinaire...

    Joined:
    Jul 19, 2001
    Messages:
    2,663
    Likes Received:
    0
    I need a utility that will generate a customizable series of lines of text, each with a sequentially higher number (+1)

    For example, say I wanted to create a series of links to pictures, all with the same text, save for a number in the file.

    I.E.

    Code:
    <a href="blah1.jpg"><img src="thumb_blah1.jpg"></a>
    <a href="blah2.jpg"><img src="thumb_blah2.jpg"></a>
    <a href="blah3.jpg"><img src="thumb_blah3.jpg"></a>
    <a href="blah4.jpg"><img src="thumb_blah4.jpg"></a>
    etc....
    
    I want to be able to specify where the in the custom text I want the number to appear, and how many iterations are necessary.

    Anyone know of a utility that exists to do this, or could create such a thing?

    It seems like it should be fairly easy, but my programming skills are beyond rusty (vb6 :o )
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Hell you could do it in an excel spreadsheet and export to text :rofl:
     
  3. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    :werd: Or with a few lines of php (since that's what I'm working in right now and it's convenient):
    PHP:
    $max last number in series;

    $text1 "<a href=\"blah";
    $text2 ".jpg\"><img src=\"thumb_blah";
    $text3 ".jpg\"></a>";

    for(
    $i 1$i <= $max$i++) {
    $text $text1 $i $text2 $i $text3;
    echo(
    "$text\n");
    }
     
  4. tac

    tac (:-|)=|=

    Joined:
    Jan 3, 2001
    Messages:
    21
    Likes Received:
    0
    Location:
    vancouver
    or with fewer lines of php:

    PHP:
    $max last number in series;  


    for(
    $i 1$i <= $max$i++) { 
        echo(
    "<a href='blah$i.jpg'><img src='thumb_blah$i.jpg'></a>\n"); 
    }  


     
  5. jayrod

    jayrod Lurker extraordinaire...

    Joined:
    Jul 19, 2001
    Messages:
    2,663
    Likes Received:
    0
    i ended up doing it in vb.net, but I was hoping someone would do a php example, since I wish to learn php in the near future

    thanks guys!!
     
  6. BaZ

    BaZ 2004 ACC Champions

    Joined:
    Jun 12, 2001
    Messages:
    2,005
    Likes Received:
    0
    Location:
    Hokieville, USA
    i see 2 examples of that in php above
     

Share This Page