1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Links Help!

Discussion in 'PHP' started by martian2k4, Aug 4, 2005.

  1. #1
    Hi, I need to be able to split up links, for instance there is a link going to be inserted into the database but instead of inserting into the database THISISTHELINK i need to make it THISI...NK if you get what i mean, like on vBulletin when you post a long link

    http://sothatitislikethiswereyouhavedotsinthemiddle

    and itll show up like

    http://sothatitis....hemiddle

    Please help ASAP :D Thanks
     
    martian2k4, Aug 4, 2005 IP
  2. rvarcher

    rvarcher Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I didn't test it but this should work. I think what you're doing should be presentation side only, not database side.

    
    $link = "http://forums.digitalpoint.com/showthread.php?t=23599";
    
    if ( strlen($link) > 40 )
    {
         $display_link = substr("$link",0,20) . "..." . substr("$link",-1,20);
    }
    
    PHP:
     
    rvarcher, Aug 4, 2005 IP
  3. martian2k4

    martian2k4 Peon

    Messages:
    74
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks :D, Works great
     
    martian2k4, Aug 4, 2005 IP