Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Robert Cummings
On Sun, 2009-04-26 at 22:52 +0530, Sudheer Satyanarayana wrote:
> Robert Cummings wrote:
> > I was about to say the same thing *lol*. tis true though, the class
> > should be "doubleQuoted" or something similar. What happens when they
> > decide it should be blue?
> >
> >   
> Aren't CSS class names supposed to be in lower case? I would go with 
> something like "double_quoted".

CSS class names are case-sensitive. IE supports insensitivity in
non-standards mode.
You're probably confusing the following:

C.13. Cascading Style Sheets (CSS) and XHTML

1. CSS style sheets for XHTML should use lower case element
   and attribute names.

This does not refer to attribute values.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Sudheer Satyanarayana

Robert Cummings wrote:

I was about to say the same thing *lol*. tis true though, the class
should be "doubleQuoted" or something similar. What happens when they
decide it should be blue?

  
Aren't CSS class names supposed to be in lower case? I would go with 
something like "double_quoted".

span.red
{
color: blue;
}

Uh huh, uh huh, uh huh :)

Cheers,
Rob.
  


--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread tedd

At 11:59 AM -0400 4/26/09, Robert Cummings wrote:

On Sun, 2009-04-26 at 11:40 -0400, tedd wrote:

 > While it might not fit with the purest css, it works for me. YMMV.  :-)

Your thinking is flawed. Yes you could have a class called center and it
does exactly that... center the text. However to make the text left
aligned you now need to edit the HTML to assign the class left intead of
center. The whole point of CSS is to not edit the HTML to make stylistic
changes. It maybe be obvious that having classes center and red makes
the content centered and coloured red, but that is no different than
having an align attribute and a color attribute which is EXACTLY what
CSS is supposed to replace.

Cheers,
Rob.


Rob:

I truly see your point and I don't disagree with it.

However, there are times where the client says "I want this centered" 
and center it you must without giving that section of text an 
attribute name.


Sure I could say "I know the client wants this selection-of-text 
centered and he isn't willing (or agree) to give this 
selection-of-text a name, so I'll do it. I'll call it this 
'selection-of-text' "selection-of-text". That way years from now when 
the client says "I no longer want that selection-of-text centered but 
right justified" I can change a single rule in the 
"selection-of-text" class attribute and the critter will be done 
without me altering a single line of html. Sure, that sounds good..


But experience has shown me that when that happens, the client 
usually doesn't single out that specific "selection-of-text" the same 
way again but rather picks something even more convoluted thereby 
defeating the entire process.


I realize that the entire idea here is to remove any need to alter 
the html to make styling changes, but clients usually negate that 
concept for when they want to change things, it's not just styling 
they want to change, but everything.


Also try explaining style sheets to a client and why they should 
think in terms of elements, blocks of text, maintenance, separating 
style from presentation, and all that other noble stuff, when all 
they what is to make something bold, centered, red, or all three.


For example, I have one client who's entire web site shows the same 
explanation-link on each page the exact same way and then he said 
"Oh, on page 43, let's change that from blue and bold to red and 
right justified." As such, I had to write page specific code to make 
that single change for that specific page plus writing a new css 
rule. Using css the correct way would have never saved me from the 
additional html work.


Sometimes simple is not only simpler, but easier to understand and 
faster to implement -- especially when you are dealing with clients 
who have absolutely no understanding of the proper ways of doing 
things. They just want their eclectic stuff shown they way they 
think, which is usually anything but organized.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Robert Cummings
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote:
> At 9:47 AM -0400 4/26/09, Robert Cummings wrote:
> >On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
> >  > On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> >  > >  > ?>
> >  > >
> >  > I'd go further on that and say don't call your class 'red', as it
> >  > doesn't do anything for semantic code, but that's just me trolling ;)
> >
> >I was about to say the same thing *lol*. tis true though, the class
> >should be "doubleQuoted" or something similar. What happens when they
> >decide it should be blue?
> >
> >span.red
> >{
> > color: blue;
> >}
> >
> >Uh huh, uh huh, uh huh :)
> 
> 
> I fully understand, but I also see two side to this.
> 
> On one side, I agree that one should always keep attributes vague 
> enough so they can be anything, such as class="warning" and that way 
> the client may say "I don't want it red now, but orange" and it will 
> be easy enough to change.
> 
> On the other side, some attributes may be exactly what they claim, 
> such as class="center" or class="red". There is little confusion 
> about what those classes mean as compared to more vague terms. As 
> such, exact attributes are indeed semantic.
> 
> So as I see it, with *some* attributes it's a toss-up  -- you can add 
> a layer of abstraction by making them vague  OR you can use a more 
> exact (semantic) meaning. I don't find much fault with either way 
> provided that it's not a big problem later. The dividing line here is 
> one of how much work it causes.
> 
> Additional consideration, one can combine exact attributes, such as 
> class="center red" and it both works and is obvious.
> 
> I often have in my css, rules such as:
> 
> .center
> {
> text-align: center;
> }
> 
> .red
> {
> color: red;
>  }
> 
> While it might not fit with the purest css, it works for me. YMMV.  :-)

Your thinking is flawed. Yes you could have a class called center and it
does exactly that... center the text. However to make the text left
aligned you now need to edit the HTML to assign the class left intead of
center. The whole point of CSS is to not edit the HTML to make stylistic
changes. It maybe be obvious that having classes center and red makes
the content centered and coloured red, but that is no different than
having an align attribute and a color attribute which is EXACTLY what
CSS is supposed to replace.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Ashley Sheridan
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote:
> At 9:47 AM -0400 4/26/09, Robert Cummings wrote:
> >On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
> >  > On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> >  > >  > ?>
> >  > >
> >  > I'd go further on that and say don't call your class 'red', as it
> >  > doesn't do anything for semantic code, but that's just me trolling ;)
> >
> >I was about to say the same thing *lol*. tis true though, the class
> >should be "doubleQuoted" or something similar. What happens when they
> >decide it should be blue?
> >
> >span.red
> >{
> > color: blue;
> >}
> >
> >Uh huh, uh huh, uh huh :)
> 
> 
> I fully understand, but I also see two side to this.
> 
> On one side, I agree that one should always keep attributes vague 
> enough so they can be anything, such as class="warning" and that way 
> the client may say "I don't want it red now, but orange" and it will 
> be easy enough to change.
> 
> On the other side, some attributes may be exactly what they claim, 
> such as class="center" or class="red". There is little confusion 
> about what those classes mean as compared to more vague terms. As 
> such, exact attributes are indeed semantic.
> 
> So as I see it, with *some* attributes it's a toss-up  -- you can add 
> a layer of abstraction by making them vague  OR you can use a more 
> exact (semantic) meaning. I don't find much fault with either way 
> provided that it's not a big problem later. The dividing line here is 
> one of how much work it causes.
> 
> Additional consideration, one can combine exact attributes, such as 
> class="center red" and it both works and is obvious.
> 
> I often have in my css, rules such as:
> 
> .center
> {
> text-align: center;
> }
> 
> .red
> {
> color: red;
>  }
> 
> While it might not fit with the purest css, it works for me. YMMV.  :-)
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
I think with semantic CSS names, it's more about why the text has to be
red, than what colour it is. So if it's red because it is a warning,
alert, etc, then it can sometimes be better to give it a name that
reflects that. This is mostly down to preference though really. I say
mostly, because some UA's might use the class names to derive
microformat information, such as dates, author names, etc.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread tedd

At 9:47 AM -0400 4/26/09, Robert Cummings wrote:

On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
 > On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
 > > 
 > >
 > I'd go further on that and say don't call your class 'red', as it
 > doesn't do anything for semantic code, but that's just me trolling ;)

I was about to say the same thing *lol*. tis true though, the class
should be "doubleQuoted" or something similar. What happens when they
decide it should be blue?

span.red
{
color: blue;
}

Uh huh, uh huh, uh huh :)



I fully understand, but I also see two side to this.

On one side, I agree that one should always keep attributes vague 
enough so they can be anything, such as class="warning" and that way 
the client may say "I don't want it red now, but orange" and it will 
be easy enough to change.


On the other side, some attributes may be exactly what they claim, 
such as class="center" or class="red". There is little confusion 
about what those classes mean as compared to more vague terms. As 
such, exact attributes are indeed semantic.


So as I see it, with *some* attributes it's a toss-up  -- you can add 
a layer of abstraction by making them vague  OR you can use a more 
exact (semantic) meaning. I don't find much fault with either way 
provided that it's not a big problem later. The dividing line here is 
one of how much work it causes.


Additional consideration, one can combine exact attributes, such as 
class="center red" and it both works and is obvious.


I often have in my css, rules such as:

.center
   {
   text-align: center;
   }

.red
   {
   color: red;
}

While it might not fit with the purest css, it works for me. YMMV.  :-)

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Robert Cummings
On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
> On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> > At 1:40 PM -0400 4/25/09, Andrew Hucks wrote:
> > >If I have something like $string = '"hello" there'; (the word hello is
> > >in double quotes, if you can't see it), how would I output it as
> > >something like "hello" there.
> > 
> > Arrggg.
> > 
> > Don't use: ""hello""
> > 
> > The font tag is dead and embedded styling should moved to css.
> > 
> > There are lot's of ways to do this, here's one:
> > 
> > 
> > 
> > You might also check out first-child in css. That way you can make 
> > "hello" in red and "there" in whatever the element color is in one 
> > statement.
> > 
> > Cheers,
> > 
> > tedd
> > 
> > 
> > -- 
> > ---
> > http://sperling.com  http://ancientstones.com  http://earthstones.com
> > 
> I'd go further on that and say don't call your class 'red', as it
> doesn't do anything for semantic code, but that's just me trolling ;)

I was about to say the same thing *lol*. tis true though, the class
should be "doubleQuoted" or something similar. What happens when they
decide it should be blue?

span.red
{
color: blue;
}

Uh huh, uh huh, uh huh :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Ashley Sheridan
On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> At 1:40 PM -0400 4/25/09, Andrew Hucks wrote:
> >If I have something like $string = '"hello" there'; (the word hello is
> >in double quotes, if you can't see it), how would I output it as
> >something like "hello" there.
> 
> Arrggg.
> 
> Don't use: ""hello""
> 
> The font tag is dead and embedded styling should moved to css.
> 
> There are lot's of ways to do this, here's one:
> 
> 
> 
> You might also check out first-child in css. That way you can make 
> "hello" in red and "there" in whatever the element color is in one 
> statement.
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
I'd go further on that and say don't call your class 'red', as it
doesn't do anything for semantic code, but that's just me trolling ;)


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread tedd

At 1:40 PM -0400 4/25/09, Andrew Hucks wrote:

If I have something like $string = '"hello" there'; (the word hello is
in double quotes, if you can't see it), how would I output it as
something like "hello" there.


Arrggg.

Don't use: ""hello""

The font tag is dead and embedded styling should moved to css.

There are lot's of ways to do this, here's one:



You might also check out first-child in css. That way you can make 
"hello" in red and "there" in whatever the element color is in one 
statement.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-26 Thread Nitsan Bin-Nun
That's what I was just about saying, in addition try to add the HTML
entities to the regular expression as well:

$string = preg_replace('/(?:& #34;|")(.*?)(?:& #34;|")/', '"\\1"', $string);

Also if you don't to get caught by the HTML validator you better surround
the color name with double quotes ;)

HTH,
Nitsan

On Sat, Apr 25, 2009 at 9:42 PM, Daniel Brown  wrote:

> On Sat, Apr 25, 2009 at 13:50, Marc Steinert  wrote:
> >
> > $string = preg_replace('/"(.*?)"/', '"\\1"',
> > $string);
>
> Close, but I'd also recommend dropping in a 'Us' modifier so that
> it is `U`ngreedy and `s`pans lines.
>
>   $regexp = '/"(.*?)"/Us';
> ?>
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Change color of anything in double/single quotes

2009-04-25 Thread Daniel Brown
On Sat, Apr 25, 2009 at 13:50, Marc Steinert  wrote:
>
> $string = preg_replace('/"(.*?)"/', '"\\1"',
> $string);

Close, but I'd also recommend dropping in a 'Us' modifier so that
it is `U`ngreedy and `s`pans lines.



-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-25 Thread Phpster



On Apr 25, 2009, at 13:40, Andrew Hucks  wrote:


If I have something like $string = '"hello" there'; (the word hello is
in double quotes, if you can't see it), how would I output it as
something like "hello" there.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Try

Echo "& #34;hello & #34;";

Remove the space between the ampersand and the hash mark


Bastien

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Change color of anything in double/single quotes

2009-04-25 Thread Andrew Hucks
If I have something like $string = '"hello" there'; (the word hello is
in double quotes, if you can't see it), how would I output it as
something like "hello" there.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Change color of anything in double/single quotes

2009-04-25 Thread Marc Steinert

Andrew Hucks wrote:

If I have something like $string = '"hello" there'; (the word hello is
in double quotes, if you can't see it), how would I output it as
something like "hello" there.



Try

$string = preg_replace('/"(.*?)"/', '"\\1"', $string);


Greetings from Germany

Marc Steinert

--
Synchronize and share your files over the web for free
http://bithub.net/

My Twitter feed
http://twitter.com/MarcSteinert





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php