Re: [PHP] Javascript and PHP interaction
What you *COULD* do is this: Use .htaccess to force your .css files to *really* be PHP files: Files ~.css ForceType application/x-httpd-php /Files [NOTE: Depending on your server configuration, the application/x-httpd-php part could be *ANYTHING* the sysadmin felt was appropriate...] Inside your CSS, you now have the full-blown power of PHP to output whatever you think is right for the CSS. But you'll need to tell the browser that this *IS* CSS output, so you'll need: ?php header(Content-type: text/css); ? at the very tip-top. Note that browsers can cache the CSS, so you'll want to add more headers to stop that, probably, or have a random value in the LINK tag in your HTML document. On Thu, March 8, 2007 3:14 am, Alain Roger wrote: Hi, I would like to know if there is a way how PHP code can extract from ElementID some property values. for example, i have the following PHP page : ?php print div class='maindiv' id='id_maindiv'my main div/div; $new_Width = somefunction(); print div class='childdiv' id='id_childdiv' style='width:.$new_Width.px;'my child div/div; ? in my CSS file (which is link to my HTML page), i have : .maindiv { width : 300px; height : 400px; background-color : #EEBBEE; } .childdiv { background-color : #BB; } my PHP code should be able : - to extract the width of id_maindiv ID (so to get 300px) and to reduce it by 50px the problem is that i tried with Javascript and if the property (style:width) is not define DIRECTLY to HTML code (but only in CSS file), the javascript is not able to return the value (but only 'undefined'). So i would like to know if PHP could help me in this way ? thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Javascript and PHP interaction
Hi, I would like to know if there is a way how PHP code can extract from ElementID some property values. for example, i have the following PHP page : ?php print div class='maindiv' id='id_maindiv'my main div/div; $new_Width = somefunction(); print div class='childdiv' id='id_childdiv' style='width:.$new_Width.px;'my child div/div; ? in my CSS file (which is link to my HTML page), i have : .maindiv { width : 300px; height : 400px; background-color : #EEBBEE; } .childdiv { background-color : #BB; } my PHP code should be able : - to extract the width of id_maindiv ID (so to get 300px) and to reduce it by 50px the problem is that i tried with Javascript and if the property (style:width) is not define DIRECTLY to HTML code (but only in CSS file), the javascript is not able to return the value (but only 'undefined'). So i would like to know if PHP could help me in this way ? thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] Javascript and PHP interaction
2007. 03. 8, csütörtök keltezéssel 09.14-kor Alain Roger ezt írta: Hi, I would like to know if there is a way how PHP code can extract from ElementID some property values. for example, i have the following PHP page : ?php print div class='maindiv' id='id_maindiv'my main div/div; $new_Width = somefunction(); print div class='childdiv' id='id_childdiv' style='width:.$new_Width.px;'my child div/div; ? in my CSS file (which is link to my HTML page), i have : .maindiv { width : 300px; height : 400px; background-color : #EEBBEE; } .childdiv { background-color : #BB; } my PHP code should be able : - to extract the width of id_maindiv ID (so to get 300px) and to reduce it by 50px the problem is that i tried with Javascript and if the property (style:width) is not define DIRECTLY to HTML code (but only in CSS file), the javascript is not able to return the value (but only 'undefined'). So i would like to know if PHP could help me in this way ? I think you can not do it with PHP. But you can do it with javascript. you have to read the offsetWidth property of the object, then set it's style.width like if (document.getElementById('whatever').offsetWidth 300) { document.getElementById('whatever').style.width = 300; } hope that helps Zoltán Németh thanks a lot, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php