-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcsstest.php
55 lines (40 loc) · 904 Bytes
/
csstest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include_once("parsecss.class.php");
$oCSS = new CSS();
$oCSS->parse_file("style.css");
var_dump($oCSS);
?>
<html>
<body>
<h3>Parse CSS file</h3>
<?php
foreach($oCSS->get_css() as $prop => $attrs) {
echo "$prop\n<ul>";
foreach($attrs as $attr => $value) {
echo "\t<li>$attr: $value\n";
}
echo "</ul>";
}
?>
<hr>
<h3>Generate new CSS content</h3>
<?php
$oCSS->set_value("body", "background-image", 'url("background2.gif")');
$oCSS->set_value("body", "font-family", '"Times New Roman"');
$oCSS->set_value("body.bottom", "font-size", "12px");
echo "<pre>". $oCSS->build_css(true). "</pre>";
?>
<hr>
<h3>Write to new CSS file</h3>
<?php $oCSS->write_file("style1.css", true); ?>
<hr>
<h3>What Tags are currently in our array?</h3>
<ul>
<?php
foreach($oCSS->get_properties() as $value0) {
echo "<li>$value0</li>\n";
}
?>
</ul>
</body>
</html>