Re: Replacing a Word

This WebDNA talk-list message is from

1999


It keeps the original formatting.
numero = 24429
interpreted = N
texte = This is to Derrick,thanks a lot, it worked excellent, but I had to change a little bit here and there. Thanks again.anup > > Anup Setty wrote: > > > Hi, > > Can anyone help me with this problem? > > I need to write the data from a textarea into the database, while > > I am doing that, I want to replace a word with an html tag. > > The text from the textarea has [image] and when I write in the > > database I want it replaced by > > > > [image] = > > > > thanks > > > > anup > > > > I worked out a little include that will do search and replace functions. call it as > follows [include file=textreplace.incl&original=[yourtext]&from=[image]&to= src=images/image.gif>] > > Hypothetically, if your textarea is [textarea], and you wished to append the information > to a database calle database.db to a field called field, you would call it as > follows: > > [append db=database.db]field=[include > file=textreplace.incl&original=[textarea]&from=[image]&to= src=images/image.gif>][/append] > > Please note a few things: First, due to the way the loop is set up, it will replace a > maximum of 100 occurances. This is arbitrary and can be raised. > Also, to use this, you will have to strip it of CRs (make it one long line), without a > linefeed at the end. I'm posting it here with CRs so people can understand what's > happening. Lastly, this routine probably strains the system somewhat. I reccomend you > don't use it to replace all occurances of a word in a full book, for example. It is far > from optimised. > > Here's the code snippet. Like I said, strip it of CRs and save it as textreplace.incl. > -- > [text show=f]x=[original][/text] > [text show=f]to=[to][/text] > [text show=f]from=[from][/text] > [loop start=1&end=100&advance=1] >
y=[text show=t]y=[middle > startafter=[text]from[/text]&endbefore=][text]x[/text][/middle][/text] > [showif [text]y[/text]![text]x[/text]] > [text show=t]z=[middle startafter=&endbefore=[text]y[/text]][text]x[/text][/middle][/text] > > [text show=t]a=[middle > startafter=&endbefore=[text]from[/text]][text]z[/text][/middle][/text] > [text show=t]x=[text]a[/text][text]to[/text][text]y[/text][/text] > [/showif] > [showif [text]y[/text]=[text]x[/text]] > [break] > [/showif] > [/loop] > [text]x[/text] > -- > > I hope you find this useful. > > > ------------------------------------------------------------- > Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. > To end your Mail problems go to . > > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > ------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Associated Messages, from the most recent to the oldest:

    
  1. Re: Replacing a Word (Anup Setty 1999)
  2. Re: Replacing a Word (Brian Boegershausen 1999)
  3. Replacing a Word (Anup Setty 1999)
  4. Re: Replacing a Word (Anup Setty 1999)
  5. Re: Replacing a Word (Rob Marquardt 1999)
  6. Re: Replacing a Word (Anup Setty 1999)
  7. Re: Replacing a Word (Derrick Puckett 1999)
  8. Re: Replacing a Word (Derrick Puckett 1999)
  9. Re: Replacing a Word (Jesse Williams Proudman 1999)
  10. Re: Replacing a Word (Derrick Puckett 1999)
  11. Replacing a Word (Anup Setty 1999)
This is to Derrick,thanks a lot, it worked excellent, but I had to change a little bit here and there. Thanks again.anup > > Anup Setty wrote: > > > Hi, > > Can anyone help me with this problem? > > I need to write the data from a textarea into the database, while > > I am doing that, I want to replace a word with an html tag. > > The text from the textarea has [image] and when I write in the > > database I want it replaced by > > > > [image] = > > > > thanks > > > > anup > > > > I worked out a little include that will do search and replace functions. call it as > follows [include file=textreplace.incl&original=[yourtext]&from=[image]&to= src=images/image.gif>] > > Hypothetically, if your textarea is [textarea], and you wished to append the information > to a database calle database.db to a field called field, you would call it as > follows: > > [append db=database.db]field=[include > file=textreplace.incl&original=[textarea]&from=[image]&to= src=images/image.gif>][/append] > > Please note a few things: First, due to the way the loop is set up, it will replace a > maximum of 100 occurances. This is arbitrary and can be raised. > Also, to use this, you will have to strip it of CRs (make it one long line), without a > linefeed at the end. I'm posting it here with CRs so people can understand what's > happening. Lastly, this routine probably strains the system somewhat. I reccomend you > don't use it to replace all occurances of a word in a full book, for example. It is far > from optimised. > > Here's the code snippet. Like I said, strip it of CRs and save it as textreplace.incl. > -- > [text show=f]x=[original][/text] > [text show=f]to=[to][/text] > [text show=f]from=[from][/text] > [loop start=1&end=100&advance=1] >
y=[text show=t]y=[middle > startafter=[text]from[/text]&endbefore=][text]x[/text][/middle][/text] > [showif [text]y[/text]![text]x[/text]] > [text show=t]z=[middle startafter=&endbefore=[text]y[/text]][text]x[/text][/middle][/text] > > [text show=t]a=[middle > startafter=&endbefore=[text]from[/text]][text]z[/text][/middle][/text] > [text show=t]x=[text]a[/text][text]to[/text][text]y[/text][/text] > [/showif] > [showif [text]y[/text]=[text]x[/text]] > [break] > [/showif] > [/loop] > [text]x[/text] > -- > > I hope you find this useful. > > > ------------------------------------------------------------- > Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. > To end your Mail problems go to . > > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > ------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Anup Setty

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

This list needs a digest: rant, rave... (1997) shipCost (1998) Problem (1997) Updating a database once per day - An example (1998) converchars in sendmail context.... (2004) New Plug-in and Type 11 errors (1997) [WebDNA] Create a cryptographic Mac key... (2016) WebCat2 Append problem (B14Macacgi) (1997) Upgrading old WebCat Database Files (1997) Fwd: [WebDNA] writefile / RETS (2009) problems with WebCat-Plugin (1997) WebCat2b15MacPlugin - showing [math] (1997) creating a ShipCosts database (1997) Sizes/Colors Options (2006) Summing fields (1997) FW: ANother SHOWIF problem (1997) wrong input values? (1997) Duplicate Cart ID (2001) Emailer problems (1998) autosensing lanague selection (1997)