Jump to content

Replace words by links


Durango

Recommended Posts

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 !

Posted

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 ?

Posted

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 :)

Posted

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 members

    • No registered users viewing this page.
×
×
  • Create New...