having a special stylesheet for 800x600 
August 24th, 2007, 12:25 AM
| | | |
Hi Folk
I was wondering if I could do the following:
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
My question is how I would write a regular expression that replaces as
follows:
YYYpx to ZZZpx
YYYem to ZZZem
YYYpt to ZZZpt
YYY% to ZZZ%
where YYY is the original numerical value and ZZZ = YYY * 0.78125.
Could you please help me to write this regular expression to test this
theory?
Thank you
Nicolaas | 
August 24th, 2007, 12:35 AM
| | | | re: having a special stylesheet for 800x600
"windandwaves" <nfrancken@gmail.comwrote in message
news:1187910993.925507.262780@x40g2000prg.googlegr oups.com... Quote:
Hi Folk
>
I was wondering if I could do the following:
>
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
>
My question is how I would write a regular expression that replaces as
follows:
>
YYYpx to ZZZpx
YYYem to ZZZem
YYYpt to ZZZpt
YYY% to ZZZ%
>
where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
Could you please help me to write this regular expression to test this
theory?
>
Thank you
>
Nicolaas
>
| Hi,
I dont understand why you want to do that.
Can you not change the dimensions to relative sizes (%)?
Richard. | 
August 24th, 2007, 12:35 AM
| | | | re: having a special stylesheet for 800x600
windandwaves wrote: Quote:
[...] that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
| Have two different style sheets with different base values on just the
<bodyelement. Have a third (cascading) sheet with the rest of the
styling, express *everything* in either percentage or em. Problem solved
without touching a single line of code.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
Un ordenador no es un televisor ni un microondas, es una herramienta
compleja. | 
August 24th, 2007, 01:35 AM
| | | | re: having a special stylesheet for 800x600
windandwaves wrote: Quote:
Hi Folk
>
I was wondering if I could do the following:
>
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
>
My question is how I would write a regular expression that replaces as
follows:
>
YYYpx to ZZZpx
YYYem to ZZZem
YYYpt to ZZZpt
YYY% to ZZZ%
>
where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
Could you please help me to write this regular expression to test this
theory?
>
Thank you
>
Nicolaas
>
| Or, better yet - don't used fixed sizes for your pages. Rather, have
pages which flow with the current window size (fluid window).
And just because my screen size is 1024x768 (or whatever) doesn't mean
my window size is. In fact, it almost never is. So your idea won't
work on my browser.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | 
August 24th, 2007, 04:55 AM
| | | | re: having a special stylesheet for 800x600
thanks for all the replies.
Just out of curiosity. Do you know what the regular expression would
be?
Thank you
Nicolaas
On Aug 24, 12:28 pm, Jerry Stuckle <jstuck...@attglobal.netwrote: Quote:
windandwaves wrote:> Quote: |
I was wondering if I could do the following:
| > Quote:
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
| > Quote:
My question is how I would write a regular expression that replaces as
follows:
| > Quote:
YYYpx to ZZZpx
YYYem to ZZZem
YYYpt to ZZZpt
YYY% to ZZZ%
| > Quote: |
where YYY is the original numerical value and ZZZ = YYY * 0.78125.
| > Quote:
Could you please help me to write this regular expression to test this
theory?
| >>>
Or, better yet - don't used fixed sizes for your pages. Rather, have
pages which flow with the current window size (fluid window).
>
And just because my screen size is 1024x768 (or whatever) doesn't mean
my window size is. In fact, it almost never is. So your idea won't
work on my browser.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
| | 
August 24th, 2007, 10:05 AM
| | | | re: having a special stylesheet for 800x600
windandwaves wrote: Quote:
Just out of curiosity. Do you know what the regular expression would
be?
| It's not a task I'd even *attempt* using regular expressions. If I really
needed to programatically modify some CSS, I'd parse the stylesheet into
some sort of object structure, tweak the objects and then re-serialise
back to CSS. Complex work, but the only way that's going to cover all the
edge cases.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 64 days, 11:52.]
TrivialEncoder/0.2 http://tobyinkster.co.uk/blog/2007/0...ivial-encoder/ | 
August 24th, 2007, 04:25 PM
| | | | re: having a special stylesheet for 800x600
On 24.08.2007 01:16 windandwaves wrote: Quote:
Hi Folk
>
I was wondering if I could do the following:
>
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
>
My question is how I would write a regular expression that replaces as
follows:
>
YYYpx to ZZZpx
YYYem to ZZZem
YYYpt to ZZZpt
YYY% to ZZZ%
>
where YYY is the original numerical value and ZZZ = YYY * 0.78125.
>
Could you please help me to write this regular expression to test this
theory?
>
|
assuming your stylesheet is in the variable $css,
$css = preg_replace_callback('/\d+(?=\s*(px|em|pt|%))/', 'convert', $css);
function convert($m) {
return round($m[0] * 800 / 1024);
}
hope this helps
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi | 
August 24th, 2007, 10:15 PM
| | | | re: having a special stylesheet for 800x600
windandwaves <nfrancken@gmail.comwrote in news:1187910993.925507.262780
@x40g2000prg.googlegroups.com: Quote:
Hi Folk
>
I was wondering if I could do the following:
>
write a php function that changes a stylesheet from 1024x768 to one
for 800x600 by literally changing all the widths, heights, font-sizes,
etc... by the ratio between 800/1024 (i.e. multiplying all values to
do with height or length with 0.78125)
>
| wow cool, using CSS completely incorrectly!
CSS = a way for your pages to look good REGARDLESS OF SCREEN RESOLUTION
Programming for screen resolution puts you squarely back to 1996. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,714 network members.
|