summaryrefslogtreecommitdiffstats
path: root/examples/examples.php
diff options
context:
space:
mode:
authorJeremy Dorn <jeremy@jeremydorn.com>2012-10-04 22:10:16 -0700
committerJeremy Dorn <jeremy@jeremydorn.com>2012-10-04 22:10:16 -0700
commitf5759ef3169fb4ef5a2bb206f3bdb8e1026546a7 (patch)
treef13623c392ebf61d76adcbfb892e6ee973976b8d /examples/examples.php
parentfbb175cb6709d584e7e6c61aeee2b929c32d9a1a (diff)
downloadsql-formatter-f5759ef3169fb4ef5a2bb206f3bdb8e1026546a7.zip
sql-formatter-f5759ef3169fb4ef5a2bb206f3bdb8e1026546a7.tar.gz
sql-formatter-f5759ef3169fb4ef5a2bb206f3bdb8e1026546a7.tar.bz2
Restructuring code to make it more maintainable.v1.0.1
Adding parameter to SqlFormatter::format() to disable syntax highlighting. Making the code compatible with PHP 5.2 by getting rid of an anonymous function.
Diffstat (limited to 'examples/examples.php')
-rw-r--r--examples/examples.php28
1 files changed, 26 insertions, 2 deletions
diff --git a/examples/examples.php b/examples/examples.php
index 5c0c52e..467f405 100644
--- a/examples/examples.php
+++ b/examples/examples.php
@@ -88,7 +88,7 @@ $comment_statements = array(
?>
-<h1>Formatting</h1>
+<h1>Formatting And Syntax Highlighting</h1>
<div>
Usage:
@@ -99,7 +99,7 @@ $comment_statements = array(
<table>
<tr>
<th>Original</th>
- <th>Formatted</th>
+ <th>Formatted And Highlighted</th>
</tr>
<?php foreach ($statements as $sql) { ?>
<tr>
@@ -112,6 +112,30 @@ $comment_statements = array(
</table>
+<h1>Formatting Only</h1>
+
+<div>
+ Usage:
+ <pre>
+ <?php highlight_string('<?php' . "\n" . '$formatted = SqlFormatter::format($sql, false);' . "\n" . '?>'); ?>
+ </pre>
+</div>
+<table>
+ <tr>
+ <th>Original</th>
+ <th>Formatted</th>
+ </tr>
+ <?php foreach ($statements as $sql) { ?>
+ <tr>
+ <td>
+ <pre><?php echo $sql; ?></pre>
+ </td>
+ <td><pre><?php echo htmlentities(SqlFormatter::format($sql,false)); ?></pre></td>
+ </tr>
+ <?php } ?>
+</table>
+
+
<h1>Syntax Highlighting Only</h1>
<div>