please help with cms for flash

I'm not very good programer, I use one php script for cms for flash.
When I make changes in text in this CMS, for example I put letters bold,
this script puts <strong></strong> on beginning and the end, but I need
<b></b> so I use str_replace to replace strong with b, and this is ok.

But when I change a color, this script puts for example <font color=#CCCCCC>
in front of letters but I need <font color="#CCCCCC"> because Flash won't
read it without quotes. And I can't say str_replace #CCCCCC with "#CCCCCC"
because I don't know wich color the person will choose.

Please if you have some idea help me!
Ana [ Mi, 25 April 2007 11:04 ] [ ID #1697338 ]

Re: please help with cms for flash

"ana" <anka [at] vizualmedia.hr> wrote in message
news:f0n5jp$er$1 [at] ss408.t-com.hr...
| I'm not very good programer, I use one php script for cms for flash.
| When I make changes in text in this CMS, for example I put letters bold,
| this script puts <strong></strong> on beginning and the end, but I need
| <b></b> so I use str_replace to replace strong with b, and this is ok.

flash doesn't recognize <strong> ?!

| But when I change a color, this script puts for example <font
color=#CCCCCC>
| in front of letters but I need <font color="#CCCCCC"> because Flash won't
| read it without quotes. And I can't say str_replace #CCCCCC with "#CCCCCC"
| because I don't know wich color the person will choose.

doesn't matter. use pre_replace. this would be similar to the pattern you'd
use (though i'm not testing it):

/<[^\s]\s+([^=\s]=([^"'\s))*?>/g

the second, inner parenthetical is the value not quoted. you'd replace $2
with '"' . $2 . '"'. this would put quotes around ever attribute in your
html that did not have quotes...and not just for the font tags...everything.

hth,

me
Steve [ Mi, 25 April 2007 15:39 ] [ ID #1697339 ]

Re: please help with cms for flash

Message-ID: <f0n5jp$er$1 [at] ss408.t-com.hr> from ana contained the
following:

>But when I change a color, this script puts for example <font color=#CCCCCC>
>in front of letters but I need <font color="#CCCCCC"> because Flash won't
>read it without quotes.

Actually you need a new CMS. <font> is so last century.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow [ Mi, 25 April 2007 15:41 ] [ ID #1697340 ]

Re: please help with cms for flash

"ana" <anka [at] vizualmedia.hr> wrote in message
news:f0n5jp$er$1 [at] ss408.t-com.hr...
> I'm not very good programer, I use one php script for cms for flash.
> When I make changes in text in this CMS, for example I put letters bold,
> this script puts <strong></strong> on beginning and the end, but I need
> <b></b> so I use str_replace to replace strong with b, and this is ok.
>
> But when I change a color, this script puts for example <font
color=#CCCCCC>
> in front of letters but I need <font color="#CCCCCC"> because Flash won't
> read it without quotes. And I can't say str_replace #CCCCCC with "#CCCCCC"
> because I don't know wich color the person will choose.
>
> Please if you have some idea help me!
>
>
This is probably a very convoluted solution but it's late and I've not had
to do this previously in php.
You will need to loop to the end of the string, which I haven't done. I
haven't tested it either, but it should work with some modification.

$f='This is a search for <font-color=#CCCCCC> and that';

$pos=array(0, 1);

$pos[0]=stripos($f, 'font-color=#', $pos[0]);
$pos[1]=stripos($f, '=', $pos[0]);
$f=substr_replace($f, '="',$pos[1], 1);
$pos[0]=stripos($f, '>', $pos[1]);
$f=substr_replace($f, '">', $pos[0], 1);

echo $f;

HTH
Vince
Vince Morgan [ Mi, 25 April 2007 15:42 ] [ ID #1697341 ]

Re: please help with cms for flash

| /<[^\s]\s+([^=\s]=([^"'\s))*?>/g

ok, i just eyeballed the above. it won't work quite yet

/<[^\s]\s+([^=\s]=([^"'\s)*\s*?])*>/g

that should work from what i can tell right now by just looking.
Steve [ Mi, 25 April 2007 15:57 ] [ ID #1697342 ]

Re: please help with cms for flash

"Vince Morgan" <vinhar [at] REMOVEoptusnet.com.au> wrote in message
news:462f5a86$0$5745$afc38c87 [at] news.optusnet.com.au...
> "ana" <anka [at] vizualmedia.hr> wrote in message
> news:f0n5jp$er$1 [at] ss408.t-com.hr...
> > I'm not very good programer, I use one php script for cms for flash.
> > When I make changes in text in this CMS, for example I put letters bold,
> > this script puts <strong></strong> on beginning and the end, but I need
> > <b></b> so I use str_replace to replace strong with b, and this is ok.
> >
> > But when I change a color, this script puts for example <font
> color=#CCCCCC>

> $pos[0]=stripos($f, 'font-color=#', $pos[0]);

Steves aproach is far superior. And the line above should be as below
anyway to account for possible spaces.

$pos[0]=stripos($f, 'font-color', $pos[0]);

> $pos[1]=stripos($f, '=', $pos[0]);
> $f=substr_replace($f, '="',$pos[1], 1);
> $pos[0]=stripos($f, '>', $pos[1]);
> $f=substr_replace($f, '">', $pos[0], 1);
Vince Morgan [ Mi, 25 April 2007 15:57 ] [ ID #1697343 ]

Re: please help with cms for flash

Thank you all for your help!

Steve please can you tell me

when I put /<[^\s]\s+([^=\s]=([^"'\s))*?>/g
in variable like this
$pre_replace="/<[^\s]\s+([^=\s]=([^"'\s))*?>/g";
It won't work, I have problem with quote inside ....^"'\s...
everything written after this var went red

----- Original Message -----
From: "Steve" <no.one [at] example.com>
Newsgroups: alt.php
Sent: 25. travanj 2007 15:57
Subject: Re: please help with cms for flash


>| /<[^\s]\s+([^=\s]=([^"'\s))*?>/g
>
> ok, i just eyeballed the above. it won't work quite yet
>
> /<[^\s]\s+([^=\s]=([^"'\s)*\s*?])*>/g
>
> that should work from what i can tell right now by just looking.
Ana [ Do, 26 April 2007 12:43 ] [ ID #1698428 ]

Re: please help with cms for flash

"ana" <anka [at] vizualmedia.hr> wrote in message
news:f0pvp1$ss2$1 [at] ss408.t-com.hr...
| Thank you all for your help!
|
| Steve please can you tell me
|
| when I put /<[^\s]\s+([^=\s]=([^"'\s))*?>/g
| in variable like this
| $pre_replace="/<[^\s]\s+([^=\s]=([^"'\s))*?>/g";
| It won't work, I have problem with quote inside ....^"'\s...
| everything written after this var went red

sorry...because you have to escape the quote.

$replace = "/<[^\s]\s+([^=\s]=([^\"'\s))*?>/g";

that should help.
Steve [ Do, 26 April 2007 15:04 ] [ ID #1698431 ]

Re: please help with cms for flash

please Steve, I'm still having a problem
it seams now with the question mark here ...*?>..

i'm working in Dramweaver and when i write that question mark everything
that is behinde shows in space for design.

> sorry...because you have to escape the quote.
>
> $replace = "/<[^\s]\s+([^=\s]=([^\"'\s))*?>/g";
>
> that should help.
>
>
Ana [ Do, 26 April 2007 15:54 ] [ ID #1698432 ]

Re: please help with cms for flash

hi again

I see now that I'm making a mistake, I'm not very good in this
can you tell me what do I need to put between

echo preg_replace("/<[^\s]\s+([^=\s]=([^\"'\s))*?>/g",
, $row["biography"]);


--
Anka Bajurin, art direktor
vizual media d.o.o.
Ivana Matetica Ronjgova 35
HR-10000 Zagreb
tel.: +385 1 3863 412, 3863 414
fax: +385 1 3887 775
gsm: +385 98 642 711
anka [at] vizualmedia.hr
info [at] vizualmedia.hr
www.vizualmedia.hr

Informacija sadržana u ovoj poruci elektronske pošte je namijenjena
naznacenim primateljima, a sadržaj iste može biti povjerljive prirode.
Ako ste ovu poruku primili greškom i nije vam namijenjena, odmah je
obrišite sa svog sistema i obavijestite pošiljatelja da ste to napravili.
Distribucija, kopiranje i otvaranje privitaka je strogo zabranjeno.

The information contained in this message is assigned only to intended
recipient and may contain legally privileged or confidential information.
If you received this message in error and you are not the intended
recipient,
delete it immediately from your system and notify sender by e-mail that you
have done so. Distribution, copying and open attachments is strictly
prohibited.
"ana" <anka [at] vizualmedia.hr> wrote in message
news:f0qau3$dqh$1 [at] ss408.t-com.hr...
> please Steve, I'm still having a problem
> it seams now with the question mark here ...*?>..
>
> i'm working in Dramweaver and when i write that question mark everything
> that is behinde shows in space for design.
>
>> sorry...because you have to escape the quote.
>>
>> $replace = "/<[^\s]\s+([^=\s]=([^\"'\s))*?>/g";
>>
>> that should help.
>>
>>
>
>
Ana [ Do, 26 April 2007 16:17 ] [ ID #1698433 ]

Re: please help with cms for flash

"ana" <anka [at] vizualmedia.hr> wrote in message
news:f0n5jp$er$1 [at] ss408.t-com.hr...
> I'm not very good programer, I use one php script for cms for flash.
> When I make changes in text in this CMS, for example I put letters bold,
> this script puts <strong></strong> on beginning and the end, but I need
> <b></b> so I use str_replace to replace strong with b, and this is ok.
>
> But when I change a color, this script puts for example <font
color=#CCCCCC>
> in front of letters but I need <font color="#CCCCCC"> because Flash won't
> read it without quotes. And I can't say str_replace #CCCCCC with "#CCCCCC"
> because I don't know wich color the person will choose.
>
> Please if you have some idea help me!
>
>

$in = 'This is <font-color=#CCCCCC>a color';
$out = preg_replace('/(font-color=)(#)([0-9a-fA-F]+)(\>)/',
'\\1'.'"\\2'.'\\3'.'"\\4', $in);

I don't have much experience with regular expressions, but this may do it
ana;
I would test it carefully first;
Vince
Vince Morgan [ Do, 26 April 2007 19:47 ] [ ID #1698434 ]

Re: please help with cms for flash

"Vince Morgan" <vinhar [at] REMOVEoptusnet.com.au> wrote in message
news:4630e557$0$6918$afc38c87 [at] news.optusnet.com.au...
> > But when I change a color, this script puts for example <font
> color=#CCCCCC>
> > in front of letters but I need <font color="#CCCCCC"> because Flash
won't
> > read it without quotes. And I can't say str_replace #CCCCCC with
"#CCCCCC"
> > because I don't know wich color the person will choose.
> >
> > Please if you have some idea help me!
> >
> >
>
> $in = 'This is <font-color=#CCCCCC>a color';
> $out = preg_replace('/(font-color=)(#)([0-9a-fA-F]+)(\>)/',
> '\\1'.'"\\2'.'\\3'.'"\\4', $in);
>
> I don't have much experience with regular expressions, but this may do it
> ana;
> I would test it carefully first;

And I wouldn't trust me not to write "<font-color" instead of <font color
If you try to use the expresions without changing that nothing will happen.
Vince Morgan [ Fr, 27 April 2007 06:27 ] [ ID #1699392 ]

Re: please help with cms for flash

"Vince Morgan" <vinhar [at] REMOVEoptusnet.com.au> wrote in message
news:46317b63$0$9772$afc38c87 [at] news.optusnet.com.au...
| "Vince Morgan" <vinhar [at] REMOVEoptusnet.com.au> wrote in message
| news:4630e557$0$6918$afc38c87 [at] news.optusnet.com.au...
| > > But when I change a color, this script puts for example <font
| > color=#CCCCCC>
| > > in front of letters but I need <font color="#CCCCCC"> because Flash
| won't
| > > read it without quotes. And I can't say str_replace #CCCCCC with
| "#CCCCCC"
| > > because I don't know wich color the person will choose.
| > >
| > > Please if you have some idea help me!
| > >
| > >
| >
| > $in = 'This is <font-color=#CCCCCC>a color';
| > $out = preg_replace('/(font-color=)(#)([0-9a-fA-F]+)(\>)/',
| > '\\1'.'"\\2'.'\\3'.'"\\4', $in);
| >
| > I don't have much experience with regular expressions, but this may do
it
| > ana;
| > I would test it carefully first;
|
| And I wouldn't trust me not to write "<font-color" instead of <font color
| If you try to use the expresions without changing that nothing will
happen.

haven't we all done that? man, i really get mad at myself when i forget the
javascript equivalent styles...like backgroundColor v. css'
background-color. i just have to remember javascript would try to subtract
color from background without this nuance.

:)
Steve [ Fr, 27 April 2007 07:12 ] [ ID #1699393 ]

OT

"Steve" <no.one [at] example.com> wrote in message
news:hAfYh.1943$sL6.413 [at] newsfe02.lga...
> | And I wouldn't trust me not to write "<font-color" instead of <font
color
> | If you try to use the expresions without changing that nothing will
> happen.
>
> haven't we all done that? man, i really get mad at myself when i forget
the
> javascript equivalent styles...like backgroundColor v. css'
> background-color. i just have to remember javascript would try to subtract
> color from background without this nuance.
>
> :)

I don't get mad at myself anymore Steve. ;)
I've had cronic fatigue for ten years now and it is so damned hard to
concentrate that mistakes are just a normal part of my day. :]
I write some code, scan for errors, fix the inevitable, write some more,
scan, etc etc.
Most of the time it's like trying to work in the front row of an ACDC
concert.
I've been surprised actualy that people haven't complained about the number
of mistakes I make on here. And it's been very highly appreciated :)
Cheers,
Vince
Vince Morgan [ Fr, 27 April 2007 08:24 ] [ ID #1699394 ]

Re: OT

Now it's working!
Thank you!


"Vince Morgan" <vinhar [at] REMOVEoptusnet.com.au> wrote in message
news:463196ce$0$20287$afc38c87 [at] news.optusnet.com.au...
> "Steve" <no.one [at] example.com> wrote in message
> news:hAfYh.1943$sL6.413 [at] newsfe02.lga...
>> | And I wouldn't trust me not to write "<font-color" instead of <font
> color
>> | If you try to use the expresions without changing that nothing will
>> happen.
>>
>> haven't we all done that? man, i really get mad at myself when i forget
> the
>> javascript equivalent styles...like backgroundColor v. css'
>> background-color. i just have to remember javascript would try to
>> subtract
>> color from background without this nuance.
>>
>> :)
>
> I don't get mad at myself anymore Steve. ;)
> I've had cronic fatigue for ten years now and it is so damned hard to
> concentrate that mistakes are just a normal part of my day. :]
> I write some code, scan for errors, fix the inevitable, write some more,
> scan, etc etc.
> Most of the time it's like trying to work in the front row of an ACDC
> concert.
> I've been surprised actualy that people haven't complained about the
> number
> of mistakes I make on here. And it's been very highly appreciated :)
> Cheers,
> Vince
>
>
Ana [ Fr, 27 April 2007 09:25 ] [ ID #1699395 ]
PHP » alt.php » please help with cms for flash

Vorheriges Thema: PHP Editor
Nächstes Thema: PHP RSS SCRIPT