Jump to content

[SOLVED] help with preg_replace


anarchoi

Recommended Posts

hi,

 

i have this script thats supposed to make a hyperlink with every keyword separated by a " + " sign

 

$title = $eventinfo[title];

$titre = preg_replace('/('. implode('|', preg_split('/\s*\+\s*/', $title, -1, PREG_SPLIT_NO_EMPTY)) .')/', '<a href="search.php?do=process&query=$1&showposts=0&forumchoice[]=16&forumchoice[]=21&forumchoice[]=42&forumchoice[]=65"  onMouseover="showmenu(event,linkset[0])" onMouseout="delayhidemenu()">$1</a>', $title); 

 

it was working good before, but i recently changed $title's informations

 

Now it look like this :

(Country) name + of + the + event + here

 

if $title contains these informations, the script would only make links with the last 4 keywords ('of', 'the', 'event' and 'here') It seems that the parentheses are messing up the script, and the first keyword right after the parenthese is never linked

 

could anyone help me solve this problem?

 

thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.