Automated exit link image

Discussion in 'PHP' started by MeAlex, Nov 2, 2005.

  1. #1
    Is there a way with PHP to insert an image next to all external links?

    I prefer to let people know with an exit link image that they will be leaving my site. I've been doing this manually and growing tired of it.
     
    MeAlex, Nov 2, 2005 IP
  2. tresman

    tresman Well-Known Member

    Messages:
    235
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    138
    #2
    And why to use php when you can use css?

    Depending on how you work, you only have to define a class, lets says .external and use it in every external link. Then, define the class:

    
    .external {
    background: url('path/to/the/image/image.gif') center left;
    padding-right: 10px; // play with this til it work as you like
    }
    
    Code (markup):
    This is how I do it and could be also used to indicate when a link goes to a pdf or word file.
     
    tresman, Nov 2, 2005 IP
    MeAlex likes this.
  3. MeAlex

    MeAlex Active Member

    Messages:
    195
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Beautiful!!!! Hadn't thought of that.
    ...some pts coming your way.
     
    MeAlex, Nov 2, 2005 IP