PHP code for making certain words links ?

Discussion in 'PHP' started by mikeote, Oct 6, 2006.

  1. #1
    Hi

    I have a vbulletin forum and I want all of one type of of word to show as a link, like intellitext but I don't want to do it through them.

    For example, every time the word "cat" shows up it will link to a website I have defined which is abouts cats, idially with alt text which will work for ie + firefox.

    Can any one tell me the php code for this ?

    Thanks
    Regards,
    Mike
     
    mikeote, Oct 6, 2006 IP
  2. Kaediem

    Kaediem Well-Known Member

    Messages:
    1,128
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    150
    #2
    I don't have the answer but it sounds interesting and useful - I'll be watching for an answer :)

    Lisa
     
    Kaediem, Oct 6, 2006 IP
  3. rb3m

    rb3m Peon

    Messages:
    192
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    str_replace($string,"cat","<a href='pageaboutcats'>cat</a>");
     
    rb3m, Oct 6, 2006 IP
  4. mikeote

    mikeote Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the reply rb3m =)

    I don't suppose you are familiar with invision board code enough to tell me where exactly this goes in the code ?

    Also do you know the code to add alt text which will work for ie & fire fox ?

    Cheers !
    Mike
     
    mikeote, Oct 7, 2006 IP
  5. rb3m

    rb3m Peon

    Messages:
    192
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No, sorry, I can't tell you exactly where to put it.

    Do you mean 'alt' as in the text that appears when you hover over the link? That's goes in the <a> tag: <a href='url' title='Alt text'>

    Check out Dustin Diaz's Sweet Titles Javascript script to make them much more visually attractive.
     
    rb3m, Oct 7, 2006 IP
  6. faraday911

    faraday911 Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You can change certain words to links with the "foul language filter" or whatever it is called in vBulletin. I came across the same problem, I run SMF and it works quite all right
     
    faraday911, Oct 7, 2006 IP
  7. mikeote

    mikeote Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks again for the replies =)

    faraday911 I have a smf forum also, acn you tell me whe the code and where to add it to make the censored words you define into links ?

    I meant as alt text as you described it rb3m, thanks for the nice link as well =)

    Mike
     
    mikeote, Oct 8, 2006 IP
  8. faraday911

    faraday911 Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    It's in the administration panel, you needn't alter the code itself, just go to the section where you can setup the words to filter and add your own words and links you want them to be replaced with
     
    faraday911, Oct 12, 2006 IP