Re: Javascript and PHP interaction

From: Date: Tue, 13 Mar 2007 01:11:52 +0000
Subject: Re: Javascript and PHP interaction
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-250372@lists.php.net to get a copy of this message
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 : #BBBBBB; > } > > 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?

« previous php.general (#250372) next »