|
Author |
Message |
jayant
Team Member


Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India
|
Posted:
Thu Mar 06, 2003 9:23 am (22 years, 1 month ago) |
  |
if "abc" and "abc def" have to be linked with URL1 and URL2
then in the text:
"kjkhj abc lkjhsdf abc def ljh"
I want the output as
"kjkhj <a href=URL1>abc</a> lkjhsdf <a href=URL2>abc def</a> ljh"
instead of
"kjkhj <a href=URL1>abc</a> lkjhsdf <a href=URL2><a href=URL1>abc</a> def</a> ljh"
or
"kjkhj <a href=URL1>abc</a> lkjhsdf <a href=URL1>abc</a> def ljh"
How can I achieve this ?
Thanks in advance.
Prize: A BMW to the one who answers this correctly  |
________________________________ Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test |
|
       |
 |
drathbun
WebHelper

Joined: 01 Mar 2003
Posts: 69
Location: Texas
|
Posted:
Thu Mar 06, 2003 3:20 pm (22 years, 1 month ago) |
  |
Here's what I would do...
Do the longer ones first, replacing the token "abc def" with some other value on a temporary basis. Then work your way down to the shorter ones. When you're done putting in the code to turn the item into a URL, replace the token strings with the original content.
In other words, sort your replacement strings by length:
abc def
abc
Next, replace abc def with ##TOKEN01##, and replace abc with ##TOKEN02##. You could use an array, where the original code is the index, as in
Code: | tokens['abc def'] = '##TOKEN01##'
tokens['abc'] = '##TOKEN02##' |
Build your urls, and then replace every token with it's original language.
Since it's not the actual code, just an idea, I'll accept a picture of a BMW instead.
Dave |
________________________________ Dave
Photography Site :: Query Tools Forum :: Weekend Fun |
|
     |
 |
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.139292 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |