11
ghia
Re: xoopsCodeDecode
  • 2008/11/22 3:10

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Easy! from
"//sU"

12
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 3:19

  • Anonymous

  • Posts: 0

  • Since:


I tested it before but it is not working. I got this:

[img align=left]'http://localhost/xoops/uploads/img48eb34622bb86.jpg'[/img]


in the article text.

13
ghia
Re: xoopsCodeDecode
  • 2008/11/22 3:56

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Humm.
"//sU"
?

14
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 4:59

  • Anonymous

  • Posts: 0

  • Since:


not worknig and also when I try without quotation marks:

$patterns[] = "//sU";


I got this result:

<img src="http://localhost/xoops/uploads/hhh.jpg align=right" />


align become inside src value.



15
ghia
Re: xoopsCodeDecode
  • 2008/11/22 14:23

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1



16
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 16:03

  • Anonymous

  • Posts: 0

  • Since:


The replacement for:
$patterns[] = "//sU";
is
Quote:
also when I try without quotation marks:

$patterns[] = "//sU";

I got this result:



align become inside src value.


17
ghia
Re: xoopsCodeDecode
  • 2008/11/22 16:23

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You have for every $patterns[] a corresponding $replacements[].

When I ask you what the replacement was for $patterns[] = "//sU";, then I wanted to know what was on the $replacements[]= line is.

If you have a lot of patterns and replacements then it is possible that some rules may interfere with each other. Position is then crucial. Start always from 'complicated' to 'simpler'.

18
Anonymous
Re: xoopsCodeDecode
  • 2008/11/22 16:29

  • Anonymous

  • Posts: 0

  • Since:


This is my code:
$startdiv '.$imgposition.'">.XOOPS_URL.'/modules/news/article.php?storyid='.$storyid.'">'
            
$style 'style="border: '.$border.'px solid #'.$bordercolor.'"';
            
$enddiv 'alt="'.$thisstory->title.'" width="'.$imgwidth.'" '.$height.' />
';
            
// [img] tags 
             
$patterns[] = "/[img align=(['"]?)(left|center|right)\1 width=(['"]?)([0-9]*)\3]([^"()?&'<>]*)[/img]/sU";
            
$patterns[] = "/[img align=(['"]?)(left|center|right)\1]([^"()?&'<>]*)[/img]/sU";
            
$patterns[] = "/[img]([^"()?&'<>]*)[/img]/sU"
            
$replacements[] = $startdiv.'.$style.' src="\3" '.$enddiv;
            
$replacements[] = $startdiv.'.$style.' src="\3" '.$enddiv;
            
$replacements[] = $startdiv.'.$style.' src="\1" '.$enddiv;
            
// img with  double quotation mark
            
$patterns[] = "/(.*)" />/sU";             
            
$patterns[] = "/(.*)" align="(.*)" />/sU";             
            
$replacements[] = $startdiv.'.$style.' src="\1" '.$enddiv;
            
$replacements[] = $startdiv.'.$style.' src="\1" align="\2" '.$enddiv;
            
// img with single quotation mark 
            
$patterns[] = "//sU";             
            
$patterns[] = "//sU";             
            
$replacements[] = $startdiv.'.$style.' src="\1" '.$enddiv;
            
$replacements[] = $startdiv.'.$style.' src="\1" align="\2" '.$enddiv;
            
// img without qutation mark
            
$patterns[] = "//sU";             
            
$patterns[] = "//sU";             
            
$replacements[] = $startdiv.'.$style.' src="\1" '.$enddiv;
            
$replacements[] = $startdiv.'.$style.' src="\1" align="\2" '.$enddiv;



19
psindia
Re: xoopsCodeDecode
  • 2008/11/24 4:05

  • psindia

  • Not too shy to talk

  • Posts: 171

  • Since: 2005/3/31


use \\2 , \\1 in the replacement string
Please don't visit ==>tenthstone.com!
==>vinodsr.com!

20
Anonymous
Re: xoopsCodeDecode
  • 2008/11/24 5:18

  • Anonymous

  • Posts: 0

  • Since:


hello vinod

I'm using it but not working, I have problem with img tag without qutation mark, for example:



this will convert to:



align attribute become insided src attribute.



Login

Who's Online

422 user(s) are online (296 user(s) are browsing Support Forums)


Members: 0


Guests: 422


more...

Donat-O-Meter

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

Latest GitHub Commits