In mysql database i have one text field called: gallery-27:
table{
..
..
}
table tr td {
..
..
}
table tr td img {
..
..
}
table tr td:hover img {
..
..
}
in gallery.php i have:
<div id="gallery-27">
<tr>
<td><a .. ><img ...></a><td>
<td><a .. ><img ...></a><td>
...
</tr>
</div>
<div id="gallery-28">
...
</div>
is there a way to combine a id="gallery-27" and code from the database in <head>
or file.css like this?
#gallery-27{
table{
..
..
}
table tr td {
..
..
}
table tr td img {
..
..
}
table tr td:hover img {
..
..
}
}
Don't work.. I no longer have ideas
OK, i use this:
echo "<style>";
while ($row = mysqli_fetch_array($res)){
$id=$row['id'];
$css=$row['css'];
$css = str_replace( "}", "} #gallery-$id ", $css );
$css = str_replace( "\n", "\r", $css );
$css = str_replace( "\t", " ", $css );
echo '#gallery-'.$id.' '.$css."{}\n";
}
echo "</style>"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.