-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
50 lines (44 loc) · 1.1 KB
/
example.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
<?php
require_once("BlargCSS.php");
$blargCSS = new BlargCSS();
$html = <<< HTML
<div style="float: left; margin: 10px; text-align: center;">
<p style="margin: 10px; text-align: center;">paragraph 1</p>
<p style="text-align: center;">paragraph 2</p>
<p style="text-align: center; float: left;">paragraph 3</p>
</div>
HTML;
$html2 = <<< HTML
<div style="float: left; padding: 10px;">
<p style="text-align: center;">paragraph 1</p>
<p style="text-align: center;">paragraph 2</p>
<p style="text-align: center; float: left; margin: 10px;">paragraph 3</p>
</div>
HTML;
$html_id = $blargCSS->addSource($html);
$html2_id = $blargCSS->addSource($html2);
$blargCSS->run();
$css = $blargCSS->getCSS();
$html_new = $blargCSS->getSource($html_id);
$html2_new = $blargCSS->getSource($html2_id);
?>
<html>
<body>
<pre>
<b>HTML input:</b>
<?=htmlentities($html)?>
<br />
<?=htmlentities($html2)?>
</pre>
<hr>
<pre>
<b>Generated CSS:</b>
<?=$css?>
<br />
<b>Generated HTML:</b>
<?=htmlentities($html_new)?>
<br />
<?=htmlentities($html2_new)?>
</pre>
</body>
</html>