1
Anonymous
xoopsCodeDecode
  • 2008/11/20 23:00

  • Anonymous

  • Posts: 0

  • Since:


Hello,

As we know xoopsCodeDecode function replace XoopsCodes with their equivalent HTML formatting.

But can I use it to replace any text ? for example replace any XOOPS with CMS inside all the articles of news module or replace align="right" with style="float:right".

I need to know what is these signs and codes meaning ?
$patterns[] = "/\[code](.*)\[\/code\]/esU";

2
Anonymous
Re: xoopsCodeDecode
  • 2008/11/21 0:10

  • Anonymous

  • Posts: 0

  • Since:


I'm tring this replacment and it is working:

$patterns[] = "/2008/sU";
$replacements[] = '2007';

Now I need to replace:
$patterns[] = "/<img ([^\"\(\)\?\&'<>]*) what is the right code here ? /sU";
with:
$replacements[] = '<a href="xxx"><img src="xxx" /></a>';

Any idea ?



3
ghia
Re: xoopsCodeDecode
  • 2008/11/21 1:39

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Maybe
"/<img src=\"(.*)\" \/>/esU"
with
"<a href=\"\\1\"><img src=\"\\1\" \/><\/a>"
I think.

4
Anonymous
Re: xoopsCodeDecode
  • 2008/11/21 2:08

  • Anonymous

  • Posts: 0

  • Since:


Hello ghia,

your code working after change esU to sU:

$patterns[] = "/<img src=\"(.*)\" \/>/sU";

Thank you



5
Anonymous
Re: xoopsCodeDecode
  • 2008/11/21 19:05

  • Anonymous

  • Posts: 0

  • Since:


Can anyone tell me what these chars meaning ?

(.*)
/\
/sU
/esU
\\1



6
ghia
Re: xoopsCodeDecode
  • 2008/11/21 19:35

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


(.*)
Group of an unknown number of characters
/\
unknown because context is incomplete
/sU
/esU
Pattern modifier
\\1
escaped backreference to group 1

7
Anonymous
Re: xoopsCodeDecode
  • 2008/11/21 19:50

  • Anonymous

  • Posts: 0

  • Since:


thank you ghia

How to do with this?

$patterns[] = "/<img src=\"(.*)\" align=\"xxx\" width=\"000\" \/>/sU";

xxx and 000 are not fixed values.


8
ghia
Re: xoopsCodeDecode
  • 2008/11/22 0:52

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Likewise:
"/<img src=\"(.*)\" align=\"(.*)\" width=\"(.*)\" \/>/sU"
with
"<a href=\"\\1\"><img src=\"\\1\"align=\"\\2\" width=\"\\3\" \/><\/a>"

9
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 2:34

  • Anonymous

  • Posts: 0

  • Since:


very clear now

I appreciate the information and advice you have given. your expertise and help have been invaluable.


10
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 2:53

  • Anonymous

  • Posts: 0

  • Since:


Hello ghia,

What's about <img src='123.jpg' /> ?

How to replace single quotation marks ?

Thank you again

Login

Who's Online

205 user(s) are online (109 user(s) are browsing Support Forums)


Members: 0


Guests: 205


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits