I mean, using css sprites on non static content like: Inside while(mysql_fetch_array())...
A:
You can use a CSS sprite anywhere you are writing HTML code... As far as "inside while...
"... i have no idea what you mean by that. If your while loop prints HTML, then yes, you can use a sprite.
webdestroya
2010-04-30 02:20:16
Thanks for reply, while($cat = mysql_fetch_array($query){?> <p><?php echo $cat['cat_name'];?></p><?php }?>How can i apply the back-ground-position?May be this way:?if($cat['cat_id'] == 1){background-position: 0 0;}...You imagine 20 categories?
jartaud
2010-04-30 02:38:27
No. You can't just dump the CSS like that, you need to have a table or something and apply the formatting to a row of the table. (But you have the right idea... just need to implement it correctly.)
webdestroya
2010-04-30 02:45:38
Thanks again: i use float left n this is the result: http://www.box.net/shared/odhcmqlssrI think with a switch case i can apply the sprites:[$id_cat]case 1: ?><p class="aClass"><?php echo $cat['cat_name'];?></p>.catCont{the css sprites}.catCont .aClass{background-position:0px -4px;}<?php break;?>
jartaud
2010-04-30 03:06:07
Yea, if you are using the PHP to generate a CSS file, then that should work for you.
webdestroya
2010-04-30 03:08:59
Thanx for ur precious time :)
jartaud
2010-04-30 03:19:44
No problem, be sure to upvote
webdestroya
2010-04-30 03:26:58
A:
your code looks like PHP. That is processed on the server to generate static HTML content. It is not executed dynamically in the browser like JavaScript. You can have have the element classes and id attributes echoed out to whatever content your'e generating in PHP and then reference those from your CSS.
Timothy
2010-04-30 02:21:17
Thanks again, the problem is: im output data in column using float left...Also i have about 20 categories. The only way i can do it is:[HARD CODED]if($cat['cat_id'] == 1){background-position: 0 0;}...
jartaud
2010-04-30 02:45:34