Jump to content

Replace words by links

Featured Replies

Posted

Hi

I would like to replace in the whole forum a special word by a link like replace keword1 by <a href="url">keyword1</a>

how can i do that ?

Tx a lot for your help !

I wonder if the bad word filter would do that for you. Use it to add the link instead of changing the word. So replace with the code.

  • Author

Hi Chilihead

Tx ! ;)

I added a filter

But it didnt replace the word in the topic

Should i wait a bit for IPB to look around the topics and replace the word ?

I believe that would affect new posts only to have it affect old you'd have to ask how, not sure.

First make sure it works works with new.

  • Author

Hey

ok i just tested, it seems it doesnt affect old posts

or maybe it will take time to affect them ?

Also for a new post, it works !

but the problem is that it doesnt take into account the html

l replaced keword1 by <a href="url">keyword1</a>

but instead of showing keyword1 it shows raw html : <a href="url">keyword1</a>

How to make it work ?

Tx a lot :)

BBcode still parses.

Or allow html.

Rebuilding post data may do it for old posts not sure, ask IPS.

  • Author

Hey

I tried, but it doesnt work, it wouldnt parse the filter words (maybe because the same word appear again in the replacement url)

on our previous forum, we used this :

require .'include/strings.php';

    global $searchReplaceword;
foreach($searchReplaceword as $search => $replace)
{
  $cur_post['message'] =
    str_replace($search,$replace,$cur_post['message']);
}

 

and then on the file strings.php :

<?php
$searchReplaceword = array(

" word1 " => " <a href='http://www.url.com/go/word1' target='_blank' rel='nofollow'>word1</a> ",
" word2 " => " <a href='http://www.url.com/go/word2' target='_blank' rel='nofollow'>word2</a> "

would be great to use this on IPB ! :)

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.